我也导入了 pytest 并安装了 pytest html,我正在尝试将元数据添加到 pytest_configure 文件中,但是当我在终端中运行测试时,我得到了找不到内部服务器错误属性
这是 conftest 文件中的内容:
#hook for adding environment info to html report
def pytest_configure(config):
config.metadata['Project Name'] = 'Hybrid Framework Practice'
config.metadata['Module Name'] = 'Customers'
config.metadata['Tester'] = 'Amar'
#hook for delete/modify environment info to html report
@pytest.mark.optionalhook
def pytest_metadata(metadata):
metadata.pop("JAVA_HOME", None)
metadata.pop("Plugins", None)
这是我在终端中运行的:
pytest -v -s -n=2 --html=Reports\report.html testCases\test_login.py --browser chrome
我在 youtube 上关注一个人,它似乎使用完全相同的代码为他运行,但对我来说它失败了。在没有 pytest_configure 代码的情况下运行上面的行可以正常工作并且测试通过有谁知道缺少什么?谢谢