简体   繁体   中英

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM