Skip to content

Commit 7b2f259

Browse files
committed
Improve coverage
1 parent ca2a3d0 commit 7b2f259

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

testing/python/metafunc.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from _pytest.compat import getfuncargnames
2020
from _pytest.compat import NOTSET
2121
from _pytest.outcomes import fail
22+
from _pytest.outcomes import Failed
2223
from _pytest.pytester import Pytester
2324
from _pytest.python import Function
2425
from _pytest.python import IdMaker
@@ -2228,6 +2229,20 @@ def test_func(foo, bar):
22282229
]
22292230
)
22302231

2232+
def test_multiple_hidden_param_is_forbidden_idmaker(self) -> None:
2233+
id_maker = IdMaker(
2234+
("foo", "bar"),
2235+
[pytest.param("a", "x"), pytest.param("b", "y")],
2236+
None,
2237+
[pytest.HIDDEN_PARAM, pytest.HIDDEN_PARAM],
2238+
None,
2239+
"some_node_id",
2240+
None,
2241+
)
2242+
expected = "In some_node_id: multiple instances of HIDDEN_PARAM"
2243+
with pytest.raises(Failed, match=expected):
2244+
id_maker.make_unique_parameterset_ids()
2245+
22312246
def test_multiple_parametrize(self, pytester: Pytester) -> None:
22322247
items = pytester.getitems(
22332248
"""

0 commit comments

Comments
 (0)