pytest 5.4.0
allure 2.6.0
allure-pytest 2.10.0
python 3.6
一:使用时生成报告出现此问题:pytest 与allure版本不兼容导致此问题
解决办法
allure 由原有2.6.0版本升级为2.13.0版本,下载2.13.0后重新配置环境变量
allure --version 查看allure版本,如果依旧为2.6.0则需要重启电脑
重新运行程序,问题解决:
二:如果不是兼容性问题引起,则可查看生成的报告json文件是否为空,如果为空,需要检查生成报告的路径是否写错,路径写错也会造成无法展示数据的情况产生
allure其他坑:
ValueError: option names {'--alluredir'} already added
原因:(pytest-allure-adaptor与allure-pytest的alluredir都被引用造成冲突)
AttributeError: module 'allure' has no attribute 'severity_level'
AttributeError: module 'pytest' has no attribute 'allure'
原因:(因为pytest-allure-adaptor库基本被python3放弃了,运行很不友好运行就是报错)
解决办法:
pip3 uninstall allure-pytest
module 'pytest' has no attribute 'allure'问题解决
pip3 uninstall pytest-allure-adaptor
pip3 install allure-pytest