py.test - How are python module paths translated to filesystem paths? -
this may seem simple question, haven't found answer explains behavior i'm seeing. hard provide simple repro case have package structure this:
a.b.c
a.b.utils
i have 1 project has files in a.b.c.
(let's call aux_project
) , has files in a.b.d
, a.b.utils
, etc (call main_project
). i'm trying import a.b.utils
inside pytest tests in first project, using tests_require
. not work because a.b
reason sourced inside aux_project/a/b/__init__.pyc
instead of virtualenv , shadows other package (i.e. a.b
has c
in it, not d
or utils
). happens in test context. in ipython can load packages fine, , correctly loaded virtualenv.
what's weirder if delete actual directory, tests load pycs virtualenv , works (i need directory, though)
python==2.7.9
what going on?
ok, problem cwd prepended pythonpath. sys.path.pop(1)
(0 tests dir, prepended pytest) resolved behavior.
Comments
Post a Comment