如何告诉 py.test 跳过某些目录? [英] How to tell py.test to skip certain directories?

查看:39
本文介绍了如何告诉 py.test 跳过某些目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 norecursedirs 选项在 setup.cfg 中告诉 py.test 不要从某些目录收集测试,但它似乎确实忽略了它.

I tried to use the norecursedirs option inside setup.cfg to tell py.test not to collect tests from certain directories but it seems it does ignore it.

[tool:pytest]
norecursedirs=lib/third

当我运行 py.test 时,我确实看到它是如何从 lib/third 内部获取测试的!

When I run py.test I do see how it does get tests from inside lib/third!

推荐答案

我解开了这个谜团:如果在一个可能的配置文件 (pytest.ini, tox.inisetup.cfg),pytest 不会查找任何其他文件,因此请确保在单个文件中定义 py.test 选项.

I solved the mystery: If a pytest section is found in one of the possible config files (pytest.ini, tox.ini and setup.cfg), pytest will not look for any others so be sure you define the py.test options in a single file.

我建议使用 setup.cfg.

这篇关于如何告诉 py.test 跳过某些目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆