I am using the command:
nosetests test.py
When this is run only the first line of the description gets printed. I want the whole description along with the test name. How do i do that?
test.py file
import unittests
class TestClass(unittest.TestCase):
def test_1(self):
"""this is a long description //
continues on second line which does not get printed """
some code;
self.assertTrue(True)
def test_2(self):
"""this is another or different long description //
continues on second line which does not get printed """
some code;
self.assertTrue(True)
if __name__ == '__main__':
unittest.main()
Unittest is documented as only showing the first line of the test method's docstring. But you could override the default implementation of
shortDescription
method to customise that behaviour:Demo:
Someone wrote a nose plugin to fix this exact annoyance, maybe you'd be interested to use that. Here it is: https://bitbucket.org/natw/nose-description-fixer-plugin/