@@ -592,12 +592,12 @@ def pytest_collect_file(file_path, parent):
592
592
hookrec .assert_contains (
593
593
[
594
594
("pytest_collectstart" , "collector.path == collector.session.path" ),
595
- ("pytest_collectstart" , "collector.__class__.__name__ == 'Module'" ),
596
- ("pytest_pycollect_makeitem" , "name == 'test_func'" ),
597
595
(
598
596
"pytest_collectstart" ,
599
597
"collector.__class__.__name__ == 'SpecialFile'" ,
600
598
),
599
+ ("pytest_collectstart" , "collector.__class__.__name__ == 'Module'" ),
600
+ ("pytest_pycollect_makeitem" , "name == 'test_func'" ),
601
601
("pytest_collectreport" , "report.nodeid.startswith(p.name)" ),
602
602
]
603
603
)
@@ -671,6 +671,23 @@ def test_method(self):
671
671
# ensure we are reporting the collection of the single test item (#2464)
672
672
assert [x .name for x in self .get_reported_items (hookrec )] == ["test_method" ]
673
673
674
+ def test_collect_parametrized_order (self , pytester : Pytester ) -> None :
675
+ p = pytester .makepyfile (
676
+ """
677
+ import pytest
678
+
679
+ @pytest.mark.parametrize('i', [0, 1, 2])
680
+ def test_param(i): ...
681
+ """
682
+ )
683
+ items , hookrec = pytester .inline_genitems (f"{ p } ::test_param" )
684
+ assert len (items ) == 3
685
+ assert [item .nodeid for item in items ] == [
686
+ "test_collect_parametrized_order.py::test_param[0]" ,
687
+ "test_collect_parametrized_order.py::test_param[1]" ,
688
+ "test_collect_parametrized_order.py::test_param[2]" ,
689
+ ]
690
+
674
691
675
692
class Test_getinitialnodes :
676
693
def test_global_file (self , pytester : Pytester ) -> None :
0 commit comments