pytest html 报告生成
pytest html report generation
我正在尝试使用 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'
有什么建议吗?
你有一个名为 request
的夹具,它与 pytest 的内置 request
夹具冲突。我建议将您的灯具命名为其他名称。
我正在尝试使用 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'
有什么建议吗?
你有一个名为 request
的夹具,它与 pytest 的内置 request
夹具冲突。我建议将您的灯具命名为其他名称。