錯誤棧信息:
INTERNALERROR> File "C:\Users\rwxwin10\AppData\Local\Programs\Python\Python38\lib\site-packages\pluggy\callers.py", line 80, in get_result ll INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "f:\testproject\graspAutoTest\conftest.py", line 34, in pytest_html_results_table_row INTERNALERROR> cells.insert(1, html.td(report.description)) INTERNALERROR> AttributeError: 'CollectReport' object has no attribute 'description'
INTERNALERROR> AttributeError: 'CollectReport' object has no attribute 'description'
INTERNALERROR> reports.append(call_and_report(item, "call", log)) INTERNALERROR> File "C:\Users\rwxwin10\AppData\Local\Programs\Python\Python38\lib\site-packages\_pytest\runner.py", line 217, in call_and_report INTERNALERROR> report: TestReport = hook.pytest_runtest_makereport(item=item, call=call) INTERNALERROR> File "C:\Users\rwxwin10\AppData\Local\Programs\Python\Python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__ INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs) INTERNALERROR> File "C:\Users\rwxwin10\AppData\Local\Programs\Python\Python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexecINTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "C:\Users\rwxwin10\AppData\Local\Programs\Python\Python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda> INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall( INTERNALERROR> File "C:\Users\rwxwin10\AppData\Local\Programs\Python\Python38\lib\site-packages\pluggy\callers.py", line 203, in _multicall INTERNALERROR> gen.send(outcome) INTERNALERROR> File "f:\testproject\graspAutoTest\conftest.py", line 58, in pytest_runtest_makereport INTERNALERROR> capture_screenshots(case_name) INTERNALERROR> File "f:\testproject\graspAutoTest\conftest.py", line 76, in capture_screenshots INTERNALERROR> raise NameError('沒有初始化測試報告目錄') INTERNALERROR> NameError: 沒有初始化測試報告目錄
NameError: 沒有初始化測試報告目錄
錯誤原因:
網上資料說是:根據錯誤提示,是conftest.py 里面的 函數 pytest_runtest_makereport出錯了,是report不存在description屬性。
有網友說是缺乏勾函數
找了幾個小時根源是源代碼的page頁的page類有錯誤參數或者測試用例的源碼有錯誤代碼:
建議:
調試重新在新項目建立函數直接運行,能直接拋出最本質的錯誤原因