我正在尝试使用 pytest-html 插件从 py.test 运行生成 html 报告,
@pytest.fixture()
def get_requests_info():
....
return [(0,'request1'),(1,'request2')]
@pytest.mark.parametrize("request", get_requests_info())
def test_a_vs_b(request):
.....
我应该如何设置环境夹具来创建 html 报告?
如果我简单地添加,
@pytest.fixture(autouse=True)
def _environment(request):
request.config._environment.append(('foo'))
我收到错误,例如,
@pytest.fixture(scope='session', autouse=True)
def environment(request):
"""Provide environment details for HTML report"""
> request.config._environment.extend([
('Python', platform.python_version()),
('Platform', platform.platform())])
E AttributeError: 'tuple' object has no attribute 'config'
有什么建议么?