pytest pluggy.manager.PluginValidationError: unknown hook 'pytest_namespace'报错处理办法
一、背景说明
上周测试的同事说pytest+allure环境在别人电脑上跑没问题,在她的环境跑却报错让帮看一下。其实pytest只是听说过allure直接没听过,但不能直接表示不会,祭出百度大法。
看环境pytest直接以python库的形式安装就可以了:pip install pytest pytest-allure-adaptor pytest-rerunfailures pytest-html
allure安装也简单下载解压然后将bin目录添加到环境变量即可。下载地址:https://github.com/allure-framework/allure2/releases/tag/2.10.0
二、问题处理
2.1 报错描述
主要运行报错如下:
pluggy.manager.PluginValidationError: unknown hook 'pytest_namespace' in plugin <module 'allure.pytest_plugin' from 'd:\\language\\miniconda3\\e
nvs\\pytest\\lib\\site-packages\\allure\\pytest_plugin.py'>
完整报错如下:
F:\PycharmProjects\pytest>pytest
==================================================================== test session starts =====================================================================
platform win32 -- Python 3.6.6, pytest-4.3.0, py-1.7.0, pluggy-0.8.1
rootdir: F:\PycharmProjects\pytest, inifile: pytest.ini
plugins: rerunfailures-6.0, metadata-1.8.0, html-1.20.0, allure-adaptor-1.7.10
collecting 1 item I
NTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\_pytest\main.py", line 210, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\_pytest\main.py", line 249, in _main
INTERNALERROR> config.hook.pytest_collection(session=session)
INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\pluggy\hooks.py", line 284, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\pluggy\manager.py", line 68, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\pluggy\manager.py", line 62, in <lambda>
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\pluggy\callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\pluggy\callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\_pytest\main.py", line 259, in pytest_collection
INTERNALERROR> return session.perform_collect()
INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\_pytest\main.py", line 487, in perform_collect
INTERNALERROR> self.config.pluginmanager.check_pending()
INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\pluggy\manager.py", line 251, in check_pending
INTERNALERROR> % (name, hookimpl.plugin),
INTERNALERROR> pluggy.manager.PluginValidationError: unknown hook 'pytest_namespace' in plugin <module 'allure.pytest_plugin' from 'd:\\language\\miniconda3\\e
nvs\\pytest\\lib\\site-packages\\allure\\pytest_plugin.py'>
2.2 报错处理
反复重新创建配置了环境突然某次成功运行了,回头排除项目使用中文路径、python环境使用中文路径、使用conda发行版后,想起google到的某个页面说过是版本问题而且自己也按其建议装了旧版本:
最后确定确实如其所说,pytest新版本(我当前是4.3.0)运行报错,换成4.0.2版本就不会报错:
# 卸载已安装的pytest
pip uninstall pytest
# 安装4.0.2版本pytest
pip install pytest==4.0.
成功运行如下图:
参考:
https://github.com/nucypher/nucypher/issues/649
pytest pluggy.manager.PluginValidationError: unknown hook 'pytest_namespace'报错处理办法的更多相关文章
- 坑:pytest 运行报错unknown hook 'pytest_namespace' in plugin <module 'allure.pytest_plugin'
右键运行pytest run时报错,原因是pytest版本过高导致的.有时候会遇到在自己本机没问题,拉取服务器代码下来后就出问题了,所以把pytest版本改低就可以,亲测有效,希望对你有帮助 完整报错 ...
- sysctl -P 报错解决办法 error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown keyerror: "net.bridge.brid ...
- Aasible中cryptography兼容性报错解决办法
Aasible中cryptography兼容性报错解决办法 1 Ansible中使用ansible --version查看版本,报错信息如下: ERROR! Unexpected Exception, ...
- sysctl -P 报错解决办法
sysctl -P 报错解决办法问题症状修改 linux 内核文件 #vi /etc/sysctl.conf后执行sysctl -P 报错error: "net.bridge.bridge ...
- sphinx :undefined reference to `libiconv' 报错解决办法
sphinx :undefined reference to `libiconv' 报错解决办法 2013-11-30 21:45:39 安装sphinx时不停报错...郁闷在make时报错,错误 ...
- spring boot jpa 使用update 报错解决办法
在spring boot jpa 中自定义sql,执行update操作报错解决办法: 在@Query(...)上添加 @Modifying@Transactional注解
- R语言安装openxl包报错解决办法
在R语言中使用openxlsx包,会报错 解决办法就是: 下载安装Set-Rtool,安装时注意勾选对话框 然后在R中运行以下代码: Sys.setenv("R_ZIPCMD" = ...
- Authentication token manipulation error报错解决办法
Authentication token manipulation error报错解决办法 #参考http://blog.163.com/junwu_lb/blog/static/1916798920 ...
- springboot x.x.x RELEASE pom 第一行报错解决办法
springboot x.x.x RELEASE pom 第一行报错解决办法 在pom.xml 文件的properties中加入maven jar插件的版本号 <properties> & ...
随机推荐
- web开发前端面试知识点目录整理
web开发前端面试知识点目录整理 基本功考察 关于Html 1. html语义化标签的理解; 结构化的理解; 能否写出简洁的html结构; SEO优化 2. h5中新增的属性; 如自定义属性data, ...
- 前端使用node.js的http-server开启一个本地服务器
前端使用node.js的http-server开启一个本地服务器 在写前端页面中,经常会在浏览器运行HTML页面,从本地文件夹中直接打开的一般都是file协议,当代码中存在http或https的链接时 ...
- 使用特性将数据库返回的datatable转换成对象列表
public class ColumnMapAttribute : Attribute { private readonly string _name; public ColumnMapAttribu ...
- Bootstrap的$(...).modal is not a function错误
使用模态对话框的时候报错了,$(...).modal is not a function 有点蒙,modal是boostrap的函数,而我已经导入了 然后在pycharm的terminal中看到了这一 ...
- 【题解】Luogu P3674 小清新人渣的本愿
原题传送门 这题还算简单(我记得我刚学oi时就来写这题,然后暴力都爆零了) 看见无修改,那么这题应该是莫队 维护两个bitset,第二个是第一个的反串,bitset内维护每个数字是否出现过 第一种操作 ...
- dataguard主库删除归档日志后从库恢复的方法
------------------方法1在主库上使用备份的进行恢复丢失的归档日志-------------------------1.发现主库备份后删除了归档,但是这些归档从库还没应用,也没有传到从 ...
- opencv学习之路(40)、人脸识别算法——EigenFace、FisherFace、LBPH
一.人脸识别算法之特征脸方法(Eigenface) 1.原理介绍及数据收集 特征脸方法主要是基于PCA降维实现. 详细介绍和主要思想可以参考 http://blog.csdn.net/u0100066 ...
- SQL Server2017还原数据库时指定mdf文件及日志文件的名称
由于需要还原同一个数据库的不同备份到不同数据库中,可是在还原的时候,可是在指定目标数据库时,填写不同的数据库名称,在SQL Server Data文件夹中生成的.mdf文件还是同一个,如图,虽然是很简 ...
- Linux操作系统中系统调用接口
进程控制 fork 创建一个新进程 clone 按指定条件创建子进程 execve 运行可执行文件 exit 终止进程 _exit 立即终止当前进程 getdtablesize 进程所能打开的最大文件 ...
- ES6 let const学习
1.let命令:用法类似于var,但是所声明的变量,只在let命令所在的代码块有效. 例:var a = [ ]; for(var i=0;i<10;i++){ a[ i ] = functio ...