我正在使用 pytest 并决定使用 测试作为应用程序代码的一部分模式。 除了conftest发现之外,一切正常。
我有以下结构:
module_a/
a.py
__tests__/
conftest.py
test_a.py
submodule/
b.py
__tests__/
test_b.py
在
conftest.py
下的 module_a/__tests__
下,我定义了我希望能够在 module_a/submodule/__tests__
中使用的装置,但它没有发现这一点。
如果我将 conftest.py
移动到 module_a
(不在 __tests__
内部),它可以工作,但我不想在 __tests__
目录之外定义它。
知道如何实现这一目标吗?