启用HTML报告时,是否禁用对STDOUT的鼻子覆盖报告? [英] Disabling nose coverage report to STDOUT when HTML report is enabled?

查看:81
本文介绍了启用HTML报告时,是否禁用对STDOUT的鼻子覆盖报告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用鼻子(通过覆盖插件,以检查我的Django项目的测试覆盖率.

I'm using nose (via django-nose) with the coverage plugin to check test coverage of my Django project.

我已经配置过鼻子以便在每次测试运行时生成HTML覆盖率报告:

I've configured nose to generate an HTML coverage report on every test run:

NOSE_ARGS = [                                                                   
    '--with-coverage',                                                            
    '--cover-package=foot',                                                       
    '--cover-html',                                                               
    '--cover-html-dir=cover',
]

现在,我想禁用每次测试运行后都会显示的纯文本覆盖率报告; HTML的功能要强大得多,而且长格式错误的表格使得很难看到实际的测试输出. nosetestscoverage似乎都没有这样的选择,或者也许我找不到它?

Now, I want to disable the plain-text coverage report that gets shown after every test run; the HTML is much more functional, and the long badly-formatted table makes it hard to see actual test output. Neither nosetests nor coverage seems to have such an option, or perhaps I just can't find one?

推荐答案

(摘自您可以安装nose-cov:

pip install nose-cov

可以更好地控制报告选项.然后,将--with-coverage更改为--with-cover,例如

which has more control over reporting options. Then, change --with-coverage to --with-cover, e.g.

NOSE_ARGS = [
 '--with-cov',
 '--cov-report', 'html',
]

将导出为HTML但抑制控制台输出.

which will export to HTML but suppress console output.

这篇关于启用HTML报告时,是否禁用对STDOUT的鼻子覆盖报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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