`py.test` and `__init__.py` files
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I thought py.test is "standalone" in a sense that it treats test_*.py files "as it is", and only imports modules specified in these files, with no respect to any surrounding files. It looks like I'm wrong. Here is my dialog with py.test : $ ls __init__.py test_pytest.py $ cat __init__.py $ cat test_pytest.py def test_pytest(): assert True $ py.test test_pytest.py ========================================================= test session starts ========================================================== platform darwin -- Python 2.7.2 -- pytest-2