Can we customize names for pytest parameters in test explorer? #21153
-
We have created a simple class to represent our test cases. We previously had a simple list of strings, and our tests where named after the string. But now with our custom class, the tests are named command1, command2, ...commandN. Is there a way that we can get the test names in the test explorer back to being the command? @dataclass
class CLICase:
command: str
expected_error_message: str = ""
expected_error_code: int = 0 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This is technically a pytest question and not a Python extension question, but it looks like you're setting the |
Beta Was this translation helpful? Give feedback.
This is technically a pytest question and not a Python extension question, but it looks like you're setting the
id
parameter for your parametrized tests. See https://docs.pytest.org/en/7.3.x/reference/reference.html#pytest.Metafunc.parametrize and/or https://docs.pytest.org/en/7.3.x/reference/reference.html#pytest-param for how set the ID explicitly.