坑:pytest 运行报错unknown hook 'pytest_namespace' in plugin module 'allure.pytest_plugin'
右键运行pytest run时报错,原因是pytest版本过高导致的。有时候会遇到在自己本机没问题,拉取服务器代码下来后就出问题了,所以把pytest版本改低就可以,亲测有效,希望对你有帮助
完整报错信息如下:
plugins: allure-adaptor-1.7.10, forked-1.0.2, html-1.20.0, metadata-1.8.0, xdist-1.29.0
collected 17 items / 1 errors / 16 selected
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\_pytest\main.py", line 213, in wrap_
session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\_pytest\main.py", line 256, in _mainINTERNALERROR> config.hook.pytest_collection(session=session)
INTERNALERROR> File "e:\python3\python3.7.332\lib\site-packages\pluggy\hooks.py", line 289, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "e:\python3\python3.7.332\lib\site-packages\pluggy\manager.py", line 87, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "e:\python3\python3.7.332\lib\site-packages\pluggy\manager.py", line 81, in <lambda>
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "e:\python3\python3.7.332\lib\site-packages\pluggy\callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "e:\python3\python3.7.332\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "e:\python3\python3.7.332\lib\site-packages\pluggy\callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\_pytest\main.py", line 266, in pytes
t_collection
INTERNALERROR> return session.perform_collect()
INTERNALERROR> File "C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages\_pytest\main.py", line 460, in perfo
rm_collect
INTERNALERROR> self.config.pluginmanager.check_pending()
INTERNALERROR> File "e:\python3\python3.7.332\lib\site-packages\pluggy\manager.py", line 270, in check_pending
INTERNALERROR> % (name, hookimpl.plugin),
INTERNALERROR> pluggy.manager.PluginValidationError: unknown hook 'pytest_namespace' in plugin <module 'allure.pytest_plugin' fr
om 'e:\\python3\\python3.7.332\\lib\\site-packages\\allure\\pytest_plugin.py'>
具体解决方案如下:
1、检查自己的pytest版本为5.0.0
2、卸载已有的pytest
pip uninstall pytest
3、指定安装pytest4.0.2版本:
pip install pytest==4.0.2 进入设置查看安装成功
4、再次右键使用pytest运行代码,运行成功,结果如下
转载于:https://www.cnblogs.com/yoyoblogs/p/11232613.html
坑:pytest 运行报错unknown hook 'pytest_namespace' in plugin module 'allure.pytest_plugin'相关推荐
- pycharm通过pytest运行报错:No test were found 解决
今天写代码犯了一个不应该犯的小错误,通过记录下来便于查看 1.报错代码如下: 1 platform win32 -- Python 3.7.3, pytest-4.0.2, py-1.8.0, plu ...
- 解决IntelliJ IDEA下Maven报错Unknown lifecycle phase “.test.skip=true“. You must specify a valid lifecycle
解决IntelliJ IDEA下Maven报错Unknown lifecycle phase ".test.skip=true". You must specify a valid ...
- 【学习react中遇到的坑:内存泄漏报错】
学习react中遇到的坑:内存泄漏报错 对就是这个错误 Can't perform a React state update on an unmounted component. This is a ...
- 解决pytest运行时报错ModuleNotFoundError
封装代码后通过pytest运行时报错模块没找到错误. 导入模块前面加上这2句话解决 No modlue name '模块名'的报错. import os,sys sys.path.append(os. ...
- 记springboot项目POM文件第一行报错 Unknown Error
pom 文件报错 UnKnown Error第一次碰到这个问题,花了几个小时才解决,除了UnKnown 没有任何提示.网上搜的大部分情况都不是我遇到的. Description Resource Pa ...
- SAP WM 自动创建TO单的JOB运行报错 - Enter the storage unit type - 对策
SAP WM 自动创建TO单的JOB运行报错 - Enter the storage unit type - 对策 报错如下: 详细信息: Log for automatic creation of ...
- vue 报错unknown custom element解决方法
vue 报错unknown custom element解决方法 参考文章: (1)vue 报错unknown custom element解决方法 (2)https://www.cnblogs.co ...
- python3运行报错:TypeError: Object of type ‘type‘ is not JSON serializable解决方法(详细)
python3运行报错:TypeError: Object of type 'type' is not JSON serializable解决方法(详细) 参考文章: (1)python3运行报错:T ...
- 关于运行robot framework 报错解决方法,ModuleNotFoundError: No module named ‘robot‘
关于运行robot framework 报错解决方法,ModuleNotFoundError: No module named 'robot' 参考文章: (1)关于运行robot framework ...
最新文章
- 2016 VR年终大趴行业大佬齐聚,共同探讨AR、VR的商业化道路之变
- typescript的命名空间
- Android SimpleAdapter的参数
- android studio怎么回退,如何回滚已经commit的代码(Android Studio)
- 神经网络与深度学习——TensorFlow2.0实战(笔记)(一)
- java 注册监听_java注册监听模型
- 类GeometricShapeFactory-JTS几何图形绘制API
- pdf合并成一个文件,pdf合并方法
- 【DIY分享】示波器(原理图+源码+仿真)
- 杂牌机刷入Xposed框架
- 制作u盘winpe启动盘_U盘启动盘制作失败怎么办 U盘启动盘制作失败解决方法【详解】...
- 学英语尽量不要从背词汇表开始
- Spring Security - 21 记住我功能
- Web开发过程流程图
- nodejs c++ addon插件的应用场景
- 三维向量类Vector类封装,包含三维向量一些基本运算
- 勤于奋国外LEAD联盟赚钱注意事项
- Scrapy 通用爬虫爬取广西人才网数据记录(上,企业信息)
- Oracle的emp表的基本函数学习
- html前台数据自动更新,网页数据如何实现实时刷新?