I am looking to clean up the normal python unittest output. I want to the console output to still be
test_isupper (__main__.TestStringMethods) ... ok
test_split (__main__.TestStringMethods) ... ok
test_upper (__main__.TestStringMethods) ... ok
test_fail (__main__.TestFail) ... ERROR
----------------------------------------------------------------------
Ran 4 tests in 0.001s
OK
But for the fail tests I want to capture the detailed output, and put that in a log file. So instead of it being inline with the console output...
======================================================================
FAIL: test_fail (__main__.TestFail)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test.py", line x
self.assertTrue(False)
AssertionError: False is not True
======================================================================
Gets logged to a file for further investigation, along with any debug level logger output. Is there a way to overload the logger in the unittest.testcase to do what I want?
I should mention I am still very new to python...
def test_fail(self): assertTrue(False)