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:

Description (last modified by Calum Lind)

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/ UserWarning:  (for module __init__) not in path importer cache (PEP 302 violation - check your local configuration).
  return theSystemPath[moduleName]



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.


Change History (4)

comment:1 Changed 5 years ago by Calum Lind

Description: modified (diff)

comment:2 Changed 5 years ago by Calum Lind

Description: modified (diff)

comment:3 Changed 5 years ago by Julian Berman

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.

comment:4 Changed 5 years ago by Jean-Paul Calderone

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 ticket:9035. If there is a reason you can't use the module-based loading, a comment on that ticket would be valuable.

Version 1, edited 5 years ago by Jean-Paul Calderone (previous) (next) (diff)
Note: See TracTickets for help on using tickets.