使用Jenkins运行python项目时报错:'_TsetResult' object has no attribute 'outputBuffer'

使用Jenkins运行python项目时报错:'_TsetResult' object has no attribute 'outputBuffer'

2020/07/15 更新


一晚上过去,早上把Jenkins卸载删除干净再重装,就一切正常了....


正在使用python+selenium练习自动化测试,使用Jenkins运行main函数时,报错:'_TsetResult' object has no attribute 'outputBuffer'

代码在本地是可以正常运行并生成测试报告的,我在网上查找了一些教程,查到有一种解决方法是这样的:

打开html_test_runner.py文件,Ctrl+F搜索TestResult,在__init__方法中添加代码:

self.outputBuffer = io.StringIO()
self.test_start_time = round(time.time(), 2)

使用Jenkins运行python项目时报错:'_TsetResult' object has no attribute 'outputBuffer'_第1张图片
添加后的代码如图。

再运行Jenkins显示代码运行成功,但是检查输出的测试报告发现测试用例没有被执行,测试报告中只有一行error

不知道到底是环境配置问题还是代码问题,有大佬知道解决方法吗?

你可能感兴趣的:(使用Jenkins运行python项目时报错:'_TsetResult' object has no attribute 'outputBuffer')