@@ -2149,7 +2149,7 @@ class TestHiddenParam:
21492149 """Test that pytest.HIDDEN_PARAM works"""
21502150
21512151 def test_parametrize_ids (self , pytester : Pytester ) -> None :
2152- pytester .makepyfile (
2152+ items = pytester .getitems (
21532153 """
21542154 import pytest
21552155
@@ -2166,18 +2166,15 @@ def test_func(foo, bar):
21662166 pass
21672167 """
21682168 )
2169- result = pytester .runpytest ("-vv" , "-s" )
2170- result .stdout .fnmatch_lines (
2171- [
2172- "test_parametrize_ids.py::test_func[paramset1] PASSED" ,
2173- "test_parametrize_ids.py::test_func PASSED" ,
2174- "test_parametrize_ids.py::test_func[paramset3] PASSED" ,
2175- "*= 3 passed in *" ,
2176- ]
2177- )
2169+ names = [item .name for item in items ]
2170+ assert names == [
2171+ "test_func[paramset1]" ,
2172+ "test_func" ,
2173+ "test_func[paramset3]" ,
2174+ ]
21782175
21792176 def test_param_id (self , pytester : Pytester ) -> None :
2180- pytester .makepyfile (
2177+ items = pytester .getitems (
21812178 """
21822179 import pytest
21832180
@@ -2193,15 +2190,12 @@ def test_func(foo, bar):
21932190 pass
21942191 """
21952192 )
2196- result = pytester .runpytest ("-vv" , "-s" )
2197- result .stdout .fnmatch_lines (
2198- [
2199- "test_param_id.py::test_func[paramset1] PASSED" ,
2200- "test_param_id.py::test_func PASSED" ,
2201- "test_param_id.py::test_func[c-z] PASSED" ,
2202- "*= 3 passed in *" ,
2203- ]
2204- )
2193+ names = [item .name for item in items ]
2194+ assert names == [
2195+ "test_func[paramset1]" ,
2196+ "test_func" ,
2197+ "test_func[c-z]" ,
2198+ ]
22052199
22062200 def test_multiple_hidden_param_is_forbidden (self , pytester : Pytester ) -> None :
22072201 pytester .makepyfile (
@@ -2235,7 +2229,7 @@ def test_func(foo, bar):
22352229 )
22362230
22372231 def test_multiple_parametrize (self , pytester : Pytester ) -> None :
2238- pytester .makepyfile (
2232+ items = pytester .getitems (
22392233 """
22402234 import pytest
22412235
@@ -2252,13 +2246,10 @@ def test_func(foo, bar):
22522246 pass
22532247 """
22542248 )
2255- result = pytester .runpytest ("-vv" , "-s" )
2256- result .stdout .fnmatch_lines (
2257- [
2258- "test_multiple_parametrize.py::test_func[a-x] PASSED" ,
2259- "test_multiple_parametrize.py::test_func[a-y] PASSED" ,
2260- "test_multiple_parametrize.py::test_func[x] PASSED" ,
2261- "test_multiple_parametrize.py::test_func[y] PASSED" ,
2262- "*= 4 passed in *" ,
2263- ]
2264- )
2249+ names = [item .name for item in items ]
2250+ assert names == [
2251+ "test_func[a-x]" ,
2252+ "test_func[a-y]" ,
2253+ "test_func[x]" ,
2254+ "test_func[y]" ,
2255+ ]
0 commit comments