I have a question with the request argument in the following code:
@pytest.fixture(scope="module")
def run_id(request):
return request.config.getoption("--run-id")
In that line of code, where are we getting the request
argument from? I searched the repo and request
isn't defined as a fixture.
The request fixture gets you access to a FixtureRequest instance. It is made available and injected manually by pytest for every test. It is used for accessing some pytest internals, in cases where you want to do something dynamic with pytest.
Its only mainstream use case (IMO) is being used in a fixture to provide access to the request.param
attribute (for parametrized fixtures). In addition to it being a critical part of a lot of advanced / unusual pytest use cases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With