Skip to content Skip to sidebar Skip to footer

Changing Verbose Report Format For Nosetests

I am running my tests using nosetests in verbose mode: .... test_cache_region (tests.test_sysutil.TestCachedMethodDecorator) ... ok test_expire (tests.test_sysutil.TestCachedMethod

Solution 1:

You need to override the str method of your TestCase class in the following way:

def __str__(self):
    return __name__ + "." + self.__class__.__name__ + "." +  self._testMethodName

Modify the return string at your will.


Solution 2:

As jorispilot suggested, you could change every single TestCase in your project. Alternately, you could change nose's behavior by creating a Nose plugin that implements describeTest. See this question on StackOverflow for an exact recipe to follow to achieve your goal.


Solution 3:

It might be worth noting that adding doc strings to your unit tests will change the output when you run them...

def test_an_empty_string_is_false(self):
    """Test that an empty string == False"""
    self.assertFalse("")

will produce Test that an empty string == False ... ok when you run nosetests with verbosity.


Post a Comment for "Changing Verbose Report Format For Nosetests"