class ATestCase(unittest.TestCase):
def test_A ...
def test_B ...
def test_C ...
The unittest output includes
test_A ...
test_B ...
test_C ...
How can I get timestamps in front of the test names? I.e I'd like to see
12:15:32 test_A ...
12:15:33 test_B ...
12:16:45 test_C ...
The obvious methods (setUp(), run...(), etc.) either place the timestamp after the test name, or lump them all together.
(This is on python 2.5)
Solved:
class MyTextTestRunner(unittest.TextTestRunner):
def _makeResult(self):
print >>stderr, _now(), ' ',
return super(MyTextTestRunner,self)._makeResult()
Update: This is only a partial solution. It only outputs the time stamp for the first test in each TestCase. (test_A in the example.)