Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling nose coverage report to STDOUT when HTML report is enabled?

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

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',
]

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?

like image 385
supervacuo Avatar asked Jul 30 '12 16:07

supervacuo


2 Answers

(Taken from this related question)

You can install nose-cov:

pip install nose-cov

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

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

which will export to HTML but suppress console output.

like image 117
scjody Avatar answered Oct 18 '22 14:10

scjody


A quick-and-dirty fix is to comment out the line that generates the unformatted coverage report in nose/plugins/cover.py:

def report(self, stream):
    ....
    log.debug("Coverage report will cover modules: %s", modules)
    #self.coverInstance.report(modules, file=stream)
like image 44
supervacuo Avatar answered Oct 18 '22 15:10

supervacuo