cannot use top level test discovery
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oslo.db |
Fix Released
|
High
|
Robert Collins |
Bug Description
Mike pointed out to me that 'testtools.run discover -t . .' fails like so:
Traceback (most recent call last):
File "/usr/lib/
"__main__", fname, loader, pkg_name)
File "/usr/lib/
exec code in run_globals
File "/home/
main()
File "/home/
stdout=stdout, exit=False)
File "/home/
__
self.
File "/home/
rgs
self.
File "/home/
loaded = loader.
File "/usr/lib/
tests = list(self.
File "/home/
for test in pkg_tests:
File "/home/
for test in pkg_tests:
File "/home/
for test in pkg_tests:
File "/home/
raise ImportError(msg % (mod_name, module_dir, expected_dir))
ImportError: 'test_base' module incorrectly imported from '/home/
This is a bug - I'm not sure where, but opening it here as a starting point.
Changed in oslo.db: | |
assignee: | nobody → Robert Collins (lifeless) |
http:// paste.ubuntu. com/8400986/ is an import trace.
This is the import: work/openstack/ oslo.db/ .tox/py27/ local/lib/ python2. 7/site- packages/ oslo/db/ sqlalchemy/ test_base. pyc matches /home/robertc/ work/openstack/ oslo.db/ .tox/py27/ local/lib/ python2. 7/site- packages/ oslo/db/ sqlalchemy/ test_base. py sqlalchemy. test_base # precompiled from /home/robertc/ work/openstack/ oslo.db/ .tox/py27/ local/lib/ python2. 7/site- packages/ oslo/db/ sqlalchemy/ test_base. pyc
# /home/robertc/
import oslo.db.
note that it is being imported from the installed tree, not the test tree.
Walking up we can see that oslo.db itself is being imported from the installed tree: work/openstack/ oslo.db/ .tox/py27/ local/lib/ python2. 7/site- packages/ oslo/db work/openstack/ oslo.db/ .tox/py27/ local/lib/ python2. 7/site- packages/ oslo/db/ __init_ _.pyc matches /home/robertc/ work/openstack/ oslo.db/ .tox/py27/ local/lib/ python2. 7/site- packages/ oslo/db/ __init_ _.py
import oslo.db # directory /home/robertc/
# /home/robertc/
(This means that if you edit code and just run tests, it won't run the new code!)