坑: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 _main INTERNALERROR> 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运行代码,运行成功,结果如下

坑:pytest 运行报错unknown hook 'pytest_namespace' in plugin <module 'allure.pytest_plugin'的更多相关文章
- pytest pluggy.manager.PluginValidationError: unknown hook 'pytest_namespace'报错处理办法
一.背景说明 上周测试的同事说pytest+allure环境在别人电脑上跑没问题,在她的环境跑却报错让帮看一下.其实pytest只是听说过allure直接没听过,但不能直接表示不会,祭出百度大法. 看 ...
- 解决chrome运行报错unknown error: cannot get automation extension
今天把默认浏览器改成chrome,结果一运行脚本就报错,具体错误信息如下. FAILED CONFIGURATION: @BeforeClass beforeClassorg.openqa.selen ...
- pycharm通过pytest运行报错:No test were found 解决
今天写代码犯了一个不应该犯的小错误,通过记录下来便于查看 1.报错代码如下: platform win32 -- Python 3.7.3, pytest-4.0.2, py-1.8.0, plugg ...
- Android 运行报错 Unknown failure (at android.os.Binder.execTransact(Binder.java:681)) Error while Installing APKs 解决办法
今天,我用手机测试的时候出现了这个错误 我网站查找了一会资料, 在运行的时候出现提示大致意思:卸载删除已存在应用程序,是否卸载现有应用程序,点击ok就会出现如下错误 原应用程序也没有卸载,然后自己手动 ...
- Nginx运行报错unknown directive ""
使用文本编辑器把编码格式修改为UTF-8即可. 推荐文本编辑器:notepad++,自行百度搜索即可下载
- vue 安装 ‘node-sass’ 运行报错:ERROR in Cannot find module 'node-sass'
好像是由于cnpm安装导致.执行下面的安装代码,或者使用npm 安装node-sass cnpm install node-sass@latest
- iOS微信支付demo运行报错解决如下
要接入微信支付的小伙伴,首先要下载一份官方demo(APP微信支付官方Demo下载),然后打开工程,准备大干一场. 1.编译报错 编译的时候居然直接报错了(orz) 错误提示: APP微信支付官方De ...
- jmeter------reponse报错”Unknown column 'XXXXX' in 'where clause'“
一.问题描述 jmeter添加了与数据库mysql的连接,编写完JDBC Request之后,运行提示报错”Unknown column 'be7f5b6e750bb6becf855386338644 ...
- scp使用加密算法报错unknown cipher type
为了提高scp的传输速度指定了scp的加密算法为arcfour $ scp -c arcfour localFile userName@remoteIP:remoteFile 得到报错unknown ...
随机推荐
- Bean管理学习笔记
1.BeanFactory 介绍 1.1 首先什么是Bean? 1.Bean在Spring技术中是基于组件 2.他是Spring容器管理的最基本最常见的单元.在spring的应用场合中,bean可以是 ...
- 使用 Code First 数据库迁移
当 Entity Framework Code First 的数据模型发生改变时,默认会引发一个System.InvalidOperationException 的异常.解决方法是使用DropCrea ...
- 【洛谷 P4070】 [SDOI2016]生成魔咒(后缀自动机)
题目链接 建出\(SAM\)后,不同子串个数就是\(\sum len(i)-len(fa(i))\) 因为\(SAM\)在线的,所以每加入一个字符就能直接加上其贡献,于是这道题就没了. 因为\(x\) ...
- Widget Size and Position !!!!!!!!!!!!!!!!!!
https://medium.com/@diegoveloper/flutter-widget-size-and-position-b0a9ffed9407 I have read many ques ...
- JavaScript 数组 遍历方法 map( ) 和 forEach( )
let arr = [1, 3, 7, 6, 9]; 不用知道元素的个数,即不用设置开始下标和结束下标. 1:forEach( )会把数组中的每个值进行操作,没有返回值,undefined let j ...
- git 命令提交项目到git服务器
1.先下载git,然后安装git https://git-scm.com/downloads 2.在电脑任意盘创建一个目录 3.在创建的目录下点击右键 4.初始化git 使用git init 初始化, ...
- [AIR] NativeExtension在IOS下的开发实例 --- IOS项目的创建 (一)
来源:http://bbs.9ria.com/thread-102037-1-1.html 最近看到本版块的很多关于NativeExtension的应用.但是都是在Android下面的应用.也有很多朋 ...
- toString()和equals()方法详解
一:toString()方法 Object中toString方法 public String toString() { return getClass().getName() + "@&qu ...
- websocket趣说_转
websocket协议:https://tools.ietf.org/html/rfc6455 作者:Ovear链接:https://www.zhihu.com/question/20215561/a ...
- /sys 和 /dev 区别
参考:What's the “/sys” directory for? Directory - /sys in linux 前言 各种Linux发行版下面似乎都有/sys目录,tree查看下面内容,会 ...