Reputation: 43
I'm trying to use pytest-html plugin to generate the html report from py.test runs,
@pytest.fixture()
def get_requests_info():
....
return [(0,'request1'),(1,'request2')]
@pytest.mark.parametrize("request", get_requests_info())
def test_a_vs_b(request):
.....
How should i set the environment fixture to create the html reports?
If I simply add,
@pytest.fixture(autouse=True)
def _environment(request):
request.config._environment.append(('foo'))
I'm getting error like,
@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'
Any suggestions?
Upvotes: 1
Views: 2025
Reputation: 11939
You have a fixture named request
which clashes with pytest's builtin request
fixture. I'd recommend just calling your fixture something else.
Upvotes: 4