一、背景说明

上周测试的同事说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'报错处理办法的更多相关文章

  1. 坑:pytest 运行报错unknown hook 'pytest_namespace' in plugin <module 'allure.pytest_plugin'

    右键运行pytest run时报错,原因是pytest版本过高导致的.有时候会遇到在自己本机没问题,拉取服务器代码下来后就出问题了,所以把pytest版本改低就可以,亲测有效,希望对你有帮助 完整报错 ...

  2. 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 ...

  3. Aasible中cryptography兼容性报错解决办法

    Aasible中cryptography兼容性报错解决办法 1 Ansible中使用ansible --version查看版本,报错信息如下: ERROR! Unexpected Exception, ...

  4. sysctl -P 报错解决办法

    sysctl -P 报错解决办法问题症状修改 linux 内核文件 #vi /etc/sysctl.conf后执行sysctl  -P 报错error: "net.bridge.bridge ...

  5. sphinx :undefined reference to `libiconv' 报错解决办法

    sphinx :undefined reference to `libiconv' 报错解决办法   2013-11-30 21:45:39 安装sphinx时不停报错...郁闷在make时报错,错误 ...

  6. spring boot jpa 使用update 报错解决办法

    在spring boot jpa 中自定义sql,执行update操作报错解决办法: 在@Query(...)上添加 @Modifying@Transactional注解

  7. R语言安装openxl包报错解决办法

    在R语言中使用openxlsx包,会报错 解决办法就是: 下载安装Set-Rtool,安装时注意勾选对话框 然后在R中运行以下代码: Sys.setenv("R_ZIPCMD" = ...

  8. Authentication token manipulation error报错解决办法

    Authentication token manipulation error报错解决办法 #参考http://blog.163.com/junwu_lb/blog/static/1916798920 ...

  9. springboot x.x.x RELEASE pom 第一行报错解决办法

    springboot x.x.x RELEASE pom 第一行报错解决办法 在pom.xml 文件的properties中加入maven jar插件的版本号 <properties> & ...

随机推荐

  1. ORA-12557协议适配器不可加载

    背景:以前电脑没有装ORACLE,仅是安装了简易客户端,此次想安装一个11g数据库,安装完成后用PLSQL登录,发现报错. 解决方案A:使用免安装的oracle客户端(instantclient_11 ...

  2. zigbee 安全通信加密链接密钥

    ---恢复内容开始--- #define KEY_TYPE_TC_MASTER  0        // Trust Center Master Key信任中心主密钥#define KEY_TYPE_ ...

  3. Django session存储到redis数据库

    把session存储到redis数据库,需要在setting中配置 django-redis 中文文档 http://django-redis-chs.readthedocs.io/zh_CN/lat ...

  4. 自定义域名访问本地WEB应用

    自定义域名访问本地WEB应用 本地安装了WEB服务端,怎样通过自定义域名方式实现从公网访问本地WEB应用? 本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装并启动WEB服务端 默认安装的WEB ...

  5. lnmp一键安装包安装失败,或者安装下载缓慢的解决办法

    使用阿里云内网安装模块 阿里云外网: ftp://soft6.vpser.net/ 阿里云云内网:ftp://10.163.196.147 修改lnmp.conf 文件 目前可用的国内LNMP ful ...

  6. 微服务化的大坑之一:当dubbo神器碰上共用注册中心和错误的暴露接口

    dubbo是国内用比较多的微服务化系统,非侵入(意思就是说不用自己写代码,把xml配置好就可以用了,这个xml的引用注解就注在springboot的开启main类里面就可以了),提供好用的均衡和容错机 ...

  7. 16: vue + crypto-js + python前后端加密解密

    1.1 vue中使用crypto-js进行AES加密解密    参考博客:https://www.cnblogs.com/qixidi/p/10137935.html 1.初始化vue项目 vue i ...

  8. Windows环境下利用anaconda3安装python版本的Xgboost

    网上有各种不同安装Xgboost的教程,但是有些教程对于一个新手来说,照着做安装成功是很困难的.本人也是新手,第一次安装Xgboost的时候,照着某个教程做,结果总是安装不上,甚至想到要放弃.后来经一 ...

  9. asp.net 对象转XML,XML转对象

    //对象转XML public static string ObjToXml(object obj) { using (MemoryStream Stream = new MemoryStream() ...

  10. js去除数组里重复的条目,返回被删除的条目的新数组

    我爱撸码,撸码使我感到快乐! 大家好,我是Counter. 今天给大家分享的是利用js进行数组的去重,还是老样子,该注释的都注释在代码里了 欢迎一起技术探讨,一起成长. 效果如下: 代码给出: // ...