[TIP] How to get coverage.py and unittest2 working together?

Jorge Vargas jorge.vargas at gmail.com
Thu Jul 22 12:09:47 PDT 2010


I'm new here and I hope this is the right list for my question, if
it's not please let me know.

I recently inherited a complex untested codebase and I'm starting by
building a robust test framework around it.

I'm used to have nose as my test suite/runner/etc. However I want to
give unittest2 a try therefore my question is how we can get the two
working together? I'm used to nose running my coverage reports for me.

In theory something like

coverage run unit2 discover

should work but it doesn't as coverage expects a .py file to execute.

In other words which should be the equivalent of nosetests --with-coverage

Thanks in advance.

More information about the testing-in-python mailing list