pythontestingnoseunittest2

Is it possible to run doctests using unit2


I recently switched from nose to the new unittest2 package for my python unit testing needs. It does everything I want, except from the fact that I can't get its "discover" command to recognize the doctests in my code - I still have to use nose to run them. Is this not implemented or is there something I'm missing here?


Solution

  • Unit2 only discovers regular Python tests. In order to have it run your doctests, I'm afraid you would need to write some minimal boilerplate. Also: the upcoming plugin architecture will make it easy to automate some of these tasks.

    In the meantime. you might want to take a look at tox (described here by unittest2 creator) http://www.voidspace.org.uk/python/weblog/arch_d7_2010_07_10.shtml