How can you get unittest2 and coverage.py working together?
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.)
I am running Windows and encountered the same problem.
$ coverage run unit2 discoverNo file to run: 'unit2'
I suspect this is related to differences in how the system path and python path are handled on various operating systems (I'm guessing Andrew is running linux?). Regardless, coverage run
takes a -m
option which allows you to run a module rather than a script. This is what I use:
coverage run -m unittest2 discover