使用unittest+HTMLTestRunnerNew的时候出现以下报错:
python unittest使用HTMLTestRunnerNew报错:ValueError: write to closed file解决方式
self.stream.write(output.encode(‘utf8’))
ValueError: write to closed file

解决方式一:
将runner.run(Test_suit)缩进到with open下运行。
python unittest使用HTMLTestRunnerNew报错:ValueError: write to closed file解决方式

解决方式二:
如果还是想要将runner顶格,那就不使用with open方法,写一个正常的文件写入操作。要注意增加关闭的操作,不然会暂用内存。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
猜你喜欢
  • 2021-09-20
  • 2022-12-23
  • 2021-03-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案