How to change unittest.TestResult to disable/remove traceback on Failures?

636 views Asked by At

I am using unittest for UI testing and HTMLTestRunner to publish test reports. To have more neat reports, I want to remove/disable traceback on output. I found sys.tracebacklimit = 0 effective but it just works on Errors and apparenty error stack is separate from failure stack in unittest.TestResult. How can I have traceback removed from failures as well?

1

There are 1 answers

0
Mahsa Mortazavi On BEST ANSWER

I changed HTMLTestRunner addError and addFailure and replaces _exc_str with " ". Also you can replace it with any desired string.