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

Jorge Vargas picture Jorge Vargas · Jul 22, 2010 · Viewed 8.2k times · Source

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.

Answer

jbastos picture jbastos · Jul 2, 2012

Try:

coverage run -m unittest discover

works for me.