python - Nose:如何默认跳过测试?

标签 python nose nosetests

我正在使用 Python 的 Nose ,我已将我的一些测试标记为“慢”,如 attrib plugin documentation 中所述。 .

我想在运行 nosetests 时默认跳过所有“慢速”测试,即无需编写 nosetests -a '!slow'。但我希望能够在显式运行这些测试或编写 nosetests -a 'slow' 时运行这些测试。

我怎样才能做到这一点?

最佳答案

“选项与命令行相同,只是删除了 -- 前缀”(https://nose.readthedocs.org/en/latest/usage.html#configuration)

具有以下内容的文件 setup.cfg 应该可以工作:

[nosetests]
attr=!speed=slow

关于python - Nose:如何默认跳过测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14674713/

相关文章:

python - 如何为 Python 程序分配更多内存?它在 4GB RAM 上消耗的内存不超过 64MB

python - 在 python 中使用线程打开风扇

python - 有效生成老虎机结果

python - 嵌套 NumPy 数组并使用拆分等方法

python - Lambda 函数简化单元测试?

python - Nose 工具和 pylint

python - Nose 测试中有条件地跳过 TestCase 装饰器

python - 如何使用 Cython 在项目中运行 Nose 测试

Python + Selenium : Running tests in parallel

python - 启用 HTML 报告时禁用向 STDOUT 报告 Nose 覆盖率?