Include pytest.HIDDEN_PARAM in parametrize(ids=...) type annotations by V1SHAL421 · Pull Request #14246 · pytest-dev/pytest
Summary
Closes #14234
The ids keyword argument of pytest.mark.parametrize did not allow pytest.HIDDEN_PARAM, unlike pytest.mark.param(id=...).
Problem
The following produced a typing error:
import pytest @pytest.mark.parametrize( "x", [1, 2, 3], ids=[pytest.HIDDEN_PARAM, "two", "three"], ) def test_example(x: int) -> None: pass
Solution
Modified _ParametrizeMarkDecorator.__call__()'s ids argument to include the _HiddenParam enum.
Test Cases
Type check for passing pytest.HIDDEN_PARAM in the ids argument for pytest.mark.parametrize
@pytest.mark.parametrize("x", [1, 2], ids=[pytest.HIDDEN_PARAM, "visible"]) def test_hidden_param(x: int) -> None: pass