[英]py.test: how to forbid to load conftest files in upper directories
I have structure like this: 我有这样的结构:
conftest.py
dir/conftest.py
dir/test_my.py
When I change directory to dir
and run py.test test_my.py
, my tests start with configuration, declared in the outer conftest.py
(which is out of dir
). 当我将目录更改为
dir
并运行py.test test_my.py
,我的测试从配置开始,该配置在外部conftest.py
声明(不在dir
)。 Is there any way to change pytest behaviour: to load conftest
-file only from the local directory? 有什么办法可以改变pytest的行为:只从本地目录加载
conftest
-file吗?
您可以设置confcutdir选项来指定pytest应该停止搜索conftest.py
文件的位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.