request
The request fixture is a special fixture that provides information about the requesting test function. It also exposes a param attribute when the fixture is parametrized, as shown in the example above.
Fixtures commonly use request to adjust their behavior dynamically based on the calling test.
python
# conftest.py
import pytest
@pytest.fixture
def get_info(request):
"""A fixture that uses 'request' to get the test's name."""
return f"Test called: {request.node.name}"
# test_example.py
def test_using_request(get_info):
# 'get_info' receives the name of this test function
assert "test_using_request" in get_info
print(get_info)