Ensuring py.test includes the application directory in sys.path
问题 I have a project directory structure as follows (which I think is pretty standard): my_project setup.py mypkg __init__.py foo.py tests functional test_f1.py unit test_u1.py I'm using py.test for my testing framework, and I'd expect to be able to run py.test tests when in the my_project directory to run my tests. This does indeed work, until I try to import my application code using (for example) import mypkg in a test. At that point, I get the error "No module named mypkg". On doing a bit of