Opened 5 years ago
Last modified 5 years ago
#9034 defect new
Unable to run trial tests (PEP 302 violation)
Reported by: | Calum Lind | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | trial | Keywords: | |
Cc: | Branch: | ||
Author: |
Description (last modified by )
Updating from 16.3 to 16.4 I encountered the following error when running trial tests:
$ trial deluge/tests/ /usr/local/lib/python2.7/dist-packages/twisted/python/modules.py:789: UserWarning: (for module __init__) not in path importer cache (PEP 302 violation - check your local configuration). return theSystemPath[moduleName] ------------------------------------------------------------------------------- PASSED
There is also a problem that it PASSED
when it should clearly be a fail especially since continuous integration systems which test with latest versions of twisted are silently passing without actually running the tests.
Just to update that the workaround is to set PYTHONPATH but this should be unneeded when running from inside the project directory.
export PYTHONPATH=$PYTHONPATH:$PWD
Change History (4)
comment:1 Changed 5 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 5 years ago by
Description: | modified (diff) |
---|
comment:3 Changed 5 years ago by
comment:4 Changed 5 years ago by
You must set PYTHONPATH
now because 16.4.0 changed trial to not add PWD for you.
Also, path-based loading in trial may be on its way out. If there is a reason you can't use the module-based loading, a comment on that ticket would be valuable.
You mentioned upgrading from 16.3 -> 16.4 -- does this happen with the latest release too?
Also, the PASSED there is because trial discovered no tests, and vacuously, none failed -- I don't think there'd be a decent way to call that a FAILURE unfortunately.
More likely though would be that warnings there should have failed the execution, i.e. PYTHONWARNINGS=error -- IIRC there's an old ticket to ask trial to set that by default, but regardless I'd recommend you set it in your CI environments.