New issue 727: Doctests: CWD vs PATH import ambiguity
https://bitbucket.org/pytest-dev/pytest/issue/727/doctests-cwd-vs-path-import-ambiguity

Andrew Pashkin:

Currently, when invoked with `--doctest-modules` option, Pytest imports modules 
from current working directory, which in some cases might break testing if it 
require to import package installed by `setup.py`. For example package can 
contain C-extensions - they can not be imported from project repository root, 
they need to be prepared for that by `distutils`. 

I see two strategies of resolving this issue:

1. Make Pytest prefer installed packages to packages from CWD
2. Make possible to explicitly set module(s) that py.test must import, so 
instead of `py.test --doctest-modules ./mypkg` invokation will look like 
`py.test --doctest-modules mypkg.*` or `py.test --doctest-modules 
mypkg.foo.bar`. I like this way more, because it completely unambugous - user 
will immediately understand, that Pytest will do `from mypkg.foo import bar` 
with respect to PATH. And PATH may contain either `site-packages` or current 
working directory.


_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to