@@ -591,12 +591,12 @@ def pytest_collect_file(file_path, parent):
591
591
hookrec .assert_contains (
592
592
[
593
593
("pytest_collectstart" , "collector.path == collector.session.path" ),
594
- ("pytest_collectstart" , "collector.__class__.__name__ == 'Module'" ),
595
- ("pytest_pycollect_makeitem" , "name == 'test_func'" ),
596
594
(
597
595
"pytest_collectstart" ,
598
596
"collector.__class__.__name__ == 'SpecialFile'" ,
599
597
),
598
+ ("pytest_collectstart" , "collector.__class__.__name__ == 'Module'" ),
599
+ ("pytest_pycollect_makeitem" , "name == 'test_func'" ),
600
600
("pytest_collectreport" , "report.nodeid.startswith(p.name)" ),
601
601
]
602
602
)
@@ -670,6 +670,23 @@ def test_method(self):
670
670
# ensure we are reporting the collection of the single test item (#2464)
671
671
assert [x .name for x in self .get_reported_items (hookrec )] == ["test_method" ]
672
672
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
+
673
690
674
691
class Test_getinitialnodes :
675
692
def test_global_file (self , pytester : Pytester ) -> None :
0 commit comments