我用在Mac上的easy_install安裝pytest,並開始了與文件結構的項目編寫測試很喜歡這樣:PATH問題與pytest「導入錯誤:沒有名爲模塊YadaYadaYada」
repo/
repo/app.py
repo/settings.py
repo/models.py
repo/tests/
repo/tests/test_app.py
運行py.test
而在回購目錄,一切都表現爲你所期望
但是當我嘗試在Linux或Windows(兩者都具有pytest 2.2.3對他們的)它吠叫時,它達到了其的東西第一進口從我的應用程序的路徑同樣的事情。舉例來說from app import some_def_in_app
我需要編輯我的PATH才能在這些系統上運行py.test嗎?有沒有人經歷過這個?
[這裏](http://docs.pytest.org/en/latest/goodpractices.html#integrating-with-setuptools-python-setup-py -test-pytest-runner)是用setuptools修復它的方法。 – ederag 2016-10-14 21:27:25