鼻子:默认情况下如何跳过测试? [英] Nose: How to skip tests by default?
问题描述
我正在使用Python的鼻子,并且已将某些测试标记为慢",如 attrib插件文档.
I am using Python's nose and I have marked some of my tests as "slow", as explained in the attrib plugin documentation.
默认情况下,我想在运行nosetests
时跳过所有慢速"测试,即不必编写nosetests -a '!slow'
.但是我希望能够在显式运行它们或编写nosetests -a 'slow'
时运行这些测试.
I would like to skip all "slow" Tests by default when running nosetests
, i.e. without having to write nosetests -a '!slow'
. But I want to be able to run these tests when explicitly running them or writing nosetests -a 'slow'
.
我该如何实现?
推荐答案
选项与命令行上的选项相同,删除了-前缀"(https://nose.readthedocs.org/en/latest/usage.html#configuration )
"Options are the same as on the command line, with the -- prefix removed" (https://nose.readthedocs.org/en/latest/usage.html#configuration)
具有以下内容的文件setup.cfg
应该可以工作:
A file setup.cfg
with the following contents should work:
[nosetests]
attr=!speed=slow
这篇关于鼻子:默认情况下如何跳过测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!