@@ -591,12 +591,12 @@ def pytest_collect_file(file_path, parent):
591591 hookrec .assert_contains (
592592 [
593593 ("pytest_collectstart" , "collector.path == collector.session.path" ),
594- ("pytest_collectstart" , "collector.__class__.__name__ == 'Module'" ),
595- ("pytest_pycollect_makeitem" , "name == 'test_func'" ),
596594 (
597595 "pytest_collectstart" ,
598596 "collector.__class__.__name__ == 'SpecialFile'" ,
599597 ),
598+ ("pytest_collectstart" , "collector.__class__.__name__ == 'Module'" ),
599+ ("pytest_pycollect_makeitem" , "name == 'test_func'" ),
600600 ("pytest_collectreport" , "report.nodeid.startswith(p.name)" ),
601601 ]
602602 )
@@ -670,6 +670,23 @@ def test_method(self):
670670 # ensure we are reporting the collection of the single test item (#2464)
671671 assert [x .name for x in self .get_reported_items (hookrec )] == ["test_method" ]
672672
673+ def test_collect_parametrized_order (self , pytester : Pytester ) -> None :
674+ p = pytester .makepyfile (
675+ """
676+ import pytest
677+
678+ @pytest.mark.parametrize('i', [0, 1, 2])
679+ def test_param(i): ...
680+ """
681+ )
682+ items , hookrec = pytester .inline_genitems (f"{ p } ::test_param" )
683+ assert len (items ) == 3
684+ assert [item .nodeid for item in items ] == [
685+ "test_collect_parametrized_order.py::test_param[0]" ,
686+ "test_collect_parametrized_order.py::test_param[1]" ,
687+ "test_collect_parametrized_order.py::test_param[2]" ,
688+ ]
689+
673690
674691class Test_getinitialnodes :
675692 def test_global_file (self , pytester : Pytester ) -> None :
0 commit comments