jeudi 31 mars 2016

How to add Test name and module to Test docstring in result?

I am using django_nose's NoseTestSuiteRunner to run tests. Currently if the test has docstring it will be printed on console for the test (TestCase.ShortDescrption()) and if it's None name of the test (TestCase.id()) is printed, I want to add TestCase.id() to TestCase.ShortDescription() so that TestCase.id() is printed regardless of docstring's presence.

sample test:

class Foo(unittest.TestCase):
      def test_bar_1(self):
          """ this is docstring 1"""
          pass

      def test_bar_2(self):
          """ this is docstring 2"""
          self.fail()

so for the result instead of

this is a docstring 1 ... ok
this is a docstring 2 ... Fail

I want

test_bar_1(path.to.test.Foo) this is a docstring 1 ... ok
test_bar_2(path.to.test.Foo) this is a docstring 2 ... Fail

Aucun commentaire:

Enregistrer un commentaire