Pytest+Allure使用问题记录

1、安装

安装过程在网上可以查到很详细的讲解,资料也较多。

2、pytest-allure-adaptor问题

大部分问题是因为,安装了”pytest-allure-adaptor“导致的,比如:
No module named 'allure.pytest_plugin'; 'allure' is not a package
此时,需要先卸载pytest-allure-adaptor,然后再 pip 安装allure-pytest包,已经安装过的不用重复安装。

3、版本问题

类似于pluggy.manager.PluginValidationError: unknown hook 'pytest_namespace' in plugin <module 'allure.pytest_plugin' from 'C:\Users\wenqi\AppData\Roaming\Python\Python37\site-packages\allure\pytest_plugin.py'>这种,一般是因为pytest版本太高导致,建议卸载现有版本并安装较低版本的pytest。

pip uninstall pytest
pip install pytest==4.0.2

4、后续

重装低版本pytest出现如下报错:
TypeError: attrib() got an unexpected keyword argument 'convert'
重装pytest最新版本并重装allure-pytest包

pip uninstall pytest
pip install pytest
pip install allure-pytest

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>