How can you get unittest2 and coverage.py working together?

Viewed 8446

How can you get unittest2 and coverage.py working together?

In theory something like

coverage run unit2 discover 

should work, but it currently just errors out.

If you are a nose user that will be the equivalent of nosetests --with-coverage.

4 Answers

This must be specific to your installation since it works fine for me

coverage run unit2 discover

to generate the coverage information then

coverage html

to generate the an HTML report (one of several reporting formats), and

open htmlcov/index.html

to see the results.

(Answering this because this is a top ghit for "unittest2 coverage" and I don't want people put off by the lack of any answer.)

Related