測試報告的標題是中文的
生成測試報告的代碼
我已經添加了encoding='utf-8'但還是亂碼。于是懷疑是HtmlTestRunner內部編碼有問題。
找到HtmlTestRunner的安裝位置(我的是C:\Users\Administrator\AppData\Local\Programs\Python\Python36\Lib\site-packages\HtmlTestRunner)
這是我的安裝位置
把result里的所有open方法添加encoding='utf-8'
把result里的所有open方法添加encoding='utf-8',問題解決。
參考資料:http://outofmemory.cn/code-snippet/629/python-duxie-file-setting-file-charaeter-coding-biru-utf-8
官網:https://github.com/oldani/HtmlTestRunner