問題:
python 執行時報錯
sortedResult = self.sortResult(result.result)
File "D:\Python39\lib\HTMLTestRunner.py", line 642, in sortResult
if not rmap.has_key(cls):
AttributeError: 'dict' object has no attribute 'has_key'
[Finished in 0.2s with exit code 1]
解決方案:
查閱資料發現,Python3以后刪除了has_key()方法
打開HTMLTestRunner.py該文件第642行,將 if not rmap.has_key(cls):改為 if not cls in rmap: 保存
再次運行腳本時,成功。