0
votes

I have a fixture, which is scoped as 'session'. This fixture does some initialization by extracting values from 'request' object.

@pytest.fixture(scope='session')
def session_context(request):
context_dict = {}
value_for_key = request.param('key')

However, when I run the tests, I get following error:

AttributeError: 'SubRequest' object has no attribute 'param'

How do I get the values from request object when the scope is session.

1

1 Answers

0
votes

I found the solution. I realized that the request object is being formed within conftest.py. After making appropriate changes, I am able to access it correctly.