【发布时间】:2021-10-13 08:51:56
【问题描述】:
我收到错误“AttributeError: module 'pytest' has no attribute 'allure' in the following code
def take_screenshots(txt):
file_name = "{}.png".format(Communication.get_random_characters())
Settings.get_driver().get_screenshot_as_file(file_name)
pytest.allure.attach.file(file_name,name=txt,attachment_type=pytest.allure.attachment_type.PNG)
E AttributeError: 模块 'pytest' 没有属性 'allure'
我在项目中使用以下插件,python 版本是最新的:3.9.7
pytest-allure=2.9.44
allure-python-commons=2.9.44
apipkg==2.0.1
attrs==21.2.0
certifi==2021.10.8
chardet==4.0.0
colorama==0.4.4
enum34==1.1.10
execnet==1.9.0
idna==3.2
lxml==4.6.3
namedlist==1.8
pluggy==1.0.0
py==1.8.2
pytest==6.2.5
pytest-forked==1.3.0
pytest-xdist==2.3.0
python-guerrillamail==0.2.0
requests==2.26.0
selenium==3.141.0
six==1.16.0
urllib3==1.26.7
imaplib2==3.6
paramiko==2.7.2
pandas==1.3.3
xlrd==2.0.1
cryptography==35.0.0
beautifulsoup4==4.10.0
bs4==0.0.1
pytest-timeout==1.4.2
xmltodict==0.12.0
谁能帮我解决这个问题?
【问题讨论】: