pytest+allure环境别人电脑运行正常,自己运行不正常几种情况

1. AttributeError:'module’ object has no attribute 'severity_level'

之前运行都是正常的,想弄allure报告,就使用pip install allure-pytest 命令安装了,其实该命令的作用是会把你当前版本的pytest卸载掉,然后安装

allure-python-commons,pytest,allure-pytest 最新版本;执行时就会出以上问题;  

然后我以为是allure的问题就把allure-python-commons 以及allure-pytest卸载了,再运行就出现了问题2

2. pluggy.manager.PluginValidationError: unknown hook 'pytest_namespace' in plugin <module 'allure.pytest_plugin' from 'd:\\python

\\lib\\site-packages\\allure\\pytest_plugin.py'>


其实以上两个问题根本原因都是同一个,pytest的版本导致的,pytest版本太新。 使用旧版本就可以解决了,切换版本步骤如下:

首先卸载新版本pytest: pip uninstall pytest
安装制定版本(可以安装你升级之前的版本),我用的是3.8.0 pip install pytest==3.8.0

安装后再次执行就可以啦!
posted @ 2019-08-23 09:32  wclcz  阅读(699)  评论(0编辑  收藏  举报