Search code examples
pythonpytest

Pytest parameter id access in test


I am using pytest and I have the id set for each parameter of a test. I use:

pytest.param([], id = "meaningful_string")

The test can access the param list. Is it also possible for the test to access the param id?


Solution

  • The id of a test can be acquired through the request fixture

    request.node.callspec.id
    

    Kudos to this post