[英]turning off coverage in nosetests
How do I conditionally turn off coverage when running nosetests? 运行鼻子测试时,如何有条件地关闭覆盖范围?
there is a --with-coverage flag that doesn't seem to do all that much. 有一个--with-coverage标志似乎并没有那么做。 It certainly does not turn off coverage.
当然,它不会关闭覆盖范围。
Mind you, I like coverage and I want to keep it. 提醒您,我喜欢承保范围,我想保留它。 I just find it extremely distracting to see its output every single time I run nosetests manually.
我发现每次手动运行鼻子测试时看到它的输出都会使人分心。 At that time, I want to see the test results and if anything failed.
当时,我想查看测试结果以及是否有任何失败。
My ~/.noserc has the following contents, but renaming the file did not help. 我的〜/ .noserc具有以下内容,但是重命名文件没有帮助。
[nosetests]
verbosity=3
with-coverage=0
match=(?:^|[\b_\./-])[Tt]est|^ut_
cover-html=1
Most of the time, I would prefer to have the same nosetests behavior as if there was no coverage installed at all. 在大多数情况下,我希望具有与完全没有安装覆盖面相同的鼻子测试行为。
Last time I installed nose, I hacked together a --cover-none 1 option by modifying the optparse in the main launch script. 上一次安装鼻子时,我通过修改主启动脚本中的optparse破解了--cover-none 1选项。 Basically, if the flag was set I would flip on the same "coverage is not installed" flag that the program uses to guard against coverage not being installed.
基本上,如果设置了该标志,我将翻转程序使用的同一“覆盖范围未安装”标志,以防止未安装coverage。 Worked fine, a bit kludgy though.
工作正常,虽然有点笨拙。
Just remove with-coverage
option entirely from config file. 只需从配置文件中完全删除
with-coverage
选项即可。
Long story: --with-coverage
, like all other plugin turn-on flags is defined as store-true
action ( in optparse context ), so any value, even 0, False or None will turn the plugin on. 长话说:--
--with-coverage
,就像所有其他插件打开标志一样,被定义为store-true
操作( 在optparse上下文中 ),因此任何值,即使是0,False或None也将打开插件。 You have to remove the option entirely. 您必须完全删除该选项。 When you remove
with-coverage,
default value of False
will be used to turn the coverage plugin off. 当您删除
with-coverage,
默认值False
将用于关闭coverage插件。
Also, try running with nosetests -v 3
to see what else could be messing with your setup. 另外,请尝试使用
nosetests -v 3
来运行,以查看设置中可能还有其他问题。 Could you have nose.cfg
sitting somewhere in your home directory? 您可以在主目录中的某处放置
nose.cfg
吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.