cmheisel / nose-xcover

Fork of nose.plugins.cover that enables XML output (for use with Hudson, e.g.)
MIT License
52 stars 17 forks source link

Don't print coverage information to stdout #17

Closed andresriancho closed 11 years ago

andresriancho commented 11 years ago

Added feature to avoid printing coverage information to stdout. This is specially useful for the use-case when we run nosetests in jenkins and we don't really care about the stdout because jenkins will parse the XML file and the stdout information just fills the log.

Don't print information to stdout:

pablo@eulogia:~/workspace/nose-xcover-andresriancho$ rm coverage.xml 
pablo@eulogia:~/workspace/nose-xcover-andresriancho$ nosetests -s --with-xcoverage --cover-erase --xcoverage-to-stdout=0
.
----------------------------------------------------------------------
Ran 1 test in 0.015s

OK

But still write the coverage.xml file:

pablo@eulogia:~/workspace/nose-xcover-andresriancho$ head coverage.xml 
<?xml version="1.0" ?>
...
pablo@eulogia:~/workspace/nose-xcover-andresriancho$ rm coverage.xml 

Print to stdout (which is also the default):

pablo@eulogia:~/workspace/nose-xcover-andresriancho$ nosetests -s --with-xcoverage --cover-erase --xcoverage-to-stdout=1
.
Name                                                                                      Stmts   Miss  Cover   Missing
-----------------------------------------------------------------------------------------------------------------------
/usr/local/lib/python2.7/dist-packages/nose/case                                            204    163    20%   5-27, 30, 35, 44, 47-56, 61-62, 66, 71-72, 76-115, 134-138, 142, 150, 153-196, 199-217, 245-260, 264, 269, 273, 278-397
...
-----------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                      2608   1940    26%   
----------------------------------------------------------------------
Ran 1 test in 0.015s

OK

And also the file is written:

pablo@eulogia:~/workspace/nose-xcover-andresriancho$ head coverage.xml 
<?xml version="1.0" ?>
...
pablo@eulogia:~/workspace/nose-xcover-andresriancho$ 
cmheisel commented 11 years ago

Thanks for the feature, I love it!

andresriancho commented 11 years ago

Great, thanks for the merge.