I am using Python Nose and would like to print the type of the test ran, like whether it is a Doctest or unittest or so? How can this be done?
Thanks.
You can create your own plugin to change the printed name of the test. Then, when you use the verbose flag the test type will print. Try something like this:
from nose.plugins import Plugin
import doctest
class CustomName(Plugin):
def describeTest(self, test):
if isinstance(test, doctest.DocTestCase):
return "Doctest: %s" % test
else:
return "Unittest: %s" % test
After installing it, run it like:
nosetests --with-customname -sv test_directory
Be warned, this is untested.