【Python】AttributeError: 'PytestPluginManager' object has no attribute 'addhooks' / pytest-html
2023-09-11 14:16:50 时间
一、报错
PS E:\WebUIAutomatedTest> pytest --html=report.html Traceback (most recent call last): File "D:\Python3.9.12\AZ\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "D:\Python3.9.12\AZ\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "D:\Python3.9.12\AZ\Scripts\pytest.exe\__main__.py", line 7, in <module> File "D:\Python3.9.12\AZ\lib\site-packages\_pytest\config\__init__.py", line 187, in console_main code = main() File "D:\Python3.9.12\AZ\lib\site-packages\_pytest\config\__init__.py", line 145, in main config = _prepareconfig(args, plugins) File "D:\Python3.9.12\AZ\lib\site-packages\_pytest\config\__init__.py", line 324, in _prepareconfig config = pluginmanager.hook.pytest_cmdline_parse( File "D:\Python3.9.12\AZ\lib\site-packages\pluggy\hooks.py", line 286, in __call__ return self._hookexec(self, self.get_hookimpls(), kwargs) File "D:\Python3.9.12\AZ\lib\site-packages\pluggy\manager.py", line 93, in _hookexec return self._inner_hookexec(hook, methods, kwargs) File "D:\Python3.9.12\AZ\lib\site-packages\pluggy\manager.py", line 84, in <lambda> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall( File "D:\Python3.9.12\AZ\lib\site-packages\pluggy\callers.py", line 203, in _multicall gen.send(outcome) File "D:\Python3.9.12\AZ\lib\site-packages\_pytest\helpconfig.py", line 102, in pytest_cmdline_parse config: Config = outcome.get_result() File "D:\Python3.9.12\AZ\lib\site-packages\pluggy\callers.py", line 80, in get_result raise ex[1].with_traceback(ex[2]) File "D:\Python3.9.12\AZ\lib\site-packages\pluggy\callers.py", line 187, in _multicall res = hook_impl.function(*args) return self._inner_hookexec(hook, methods, kwargs) File "D:\Python3.9.12\AZ\lib\site-packages\pluggy\manager.py", line 84, in <lambda> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall( File "D:\Python3.9.12\AZ\lib\site-packages\pluggy\callers.py", line 208, in _multicall return outcome.get_result() File "D:\Python3.9.12\AZ\lib\site-packages\pluggy\callers.py", line 80, in get_result raise ex[1].with_traceback(ex[2]) File "D:\Python3.9.12\AZ\lib\site-packages\pluggy\callers.py", line 187, in _multicall res = hook_impl.function(*args) File "D:\Python3.9.12\AZ\lib\site-packages\pytest_html\plugin.py", line 31, in pytest_addhooks pluginmanager.addhooks(newhooks) AttributeError: 'PytestPluginManager' object has no attribute 'addhooks' PS E:\WebUIAutomatedTest>
二、解决
重装一下pytest-html包 换个最新版本就行了(原:pytest-html==1.3,现:pytest-html==3.1.1)
pip uninstall pytest-html
pip install pytest-html
相关文章
- Python的dict字典结构操作方法学习笔记
- Python 字符串_python 字符串截取_python 字符串替换_python 字符串连接
- Python 字符串_python 字符串截取_python 字符串替换_python 字符串连接
- [Python Test] Use pytest fixtures to reduce duplicated code across unit tests
- linux执行python命令后permission denied
- Python每日一练(20230220)
- Python:更改默认启动的python程序及其对应的安装包路径(更改pip的默认安装包的路径)图文教程之详细攻略
- Python:利用python编程将上海十六区,2020年5月份房价实时地图(数据来源房天下)进行柱状图、热图可视化
- Python之tkinter:动态演示调用python库的tkinter带你进入GUI世界(Entry/Entry的Command)
- Python:python代码编程带你玩转双色球(了解双色球的概率逻辑)
- Python之多线程:python多线程设计之同时执行多个函数命令详细攻略
- 成功解决PermissionError(权限拒绝解决答案集锦): [Errno 13] Permission denied: ‘f:program filespythonpython36
- 已解决2.Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and wi
- 〖Python语法进阶篇⑩〗- 正则表达式的字符匹配
- 〖Python自动化办公篇⑳〗 - python实现邮件自动化 - 发送html邮件和带附件的邮件
- 〖Python 数据库开发实战 - Python与MySQL交互篇⑩〗- 创建新闻管理系统的具体python文件
- Python 去掉文本中空行
- Python测开面试题之装饰器 | 干货
- python+pytest接口自动化 —— 自动化用例编写思路 (使用pytest编写一个测试脚本)
- supervisor支持python虚拟环境venv
- 【Python实战】 ---- python 实现 CSDN 的定时自动签到
- python word2vector (三)
- error_description‘: ‘遇到错误,请刷新页面或者重新登录帐号后再试‘, ‘er 网络爬虫需要cookies python 爬虫