I'm having problems with pytest not including my projects rootdir in sys.path list. Instead it is including the directory where the tests are located by default.
Here is my project structure.
proj/
setup.py
mypackage/
__init__.py
a.py
tests/
test_a.py
when running pytest with
py.test proj/mypackage/tests
it inserts proj/mypackage/tests into sys.path which is not good because now I cannot import a since its not relative to the tests directory.
I've noticed that py.test detects a rootdir, this is recognized as the root of my project which is the proj directory. This is what I want in sys.path during tests so all my code is relative to that directory. How do I ensure py.test includes (...)/proj/ in sys.path so that I can import mypackage.a
in test_a.py.