1010from tests .regression .cases import discover_cases
1111from tests .regression .helpers import run_codeentropy_with_config
1212
13+ CASES = discover_cases ()
14+
15+
16+ def pytest_generate_tests (metafunc : pytest .Metafunc ) -> None :
17+ """
18+ Dynamically parametrize regression test cases.
19+
20+ This hook enables pytest-xdist to distribute individual regression cases
21+ across multiple workers by generating test parametrization at collection time.
22+
23+ Args:
24+ metafunc (pytest.Metafunc): Pytest metafunction object used to inspect
25+ and modify test function parametrization.
26+ """
27+ if "case" in metafunc .fixturenames :
28+ metafunc .parametrize (
29+ "case" ,
30+ CASES ,
31+ ids = [c .id for c in CASES ],
32+ )
33+
1334
1435def _group_index (payload : dict [str , Any ]) -> dict [str , dict [str , Any ]]:
1536 """
@@ -106,9 +127,10 @@ def _compare_grouped(
106127
107128
108129@pytest .mark .regression
109- @pytest .mark .parametrize ("case" , discover_cases ())
110130def test_regression_matches_baseline (
111- tmp_path : Path , case , request : pytest .FixtureRequest
131+ tmp_path : Path ,
132+ case ,
133+ request : pytest .FixtureRequest ,
112134) -> None :
113135 """
114136 Execute a regression test for a single scenario and compare against baseline.
@@ -121,8 +143,9 @@ def test_regression_matches_baseline(
121143
122144 Args:
123145 tmp_path (Path): Temporary directory provided by pytest.
124- case (RegressionCase): Parameterized regression case.
125- request (pytest.FixtureRequest): Pytest request object for accessing CLI options
146+ case: A RegressionCase instance containing system, config, and baseline paths.
147+ request (pytest.FixtureRequest): Pytest request object used to access CLI
148+ options.
126149
127150 Raises:
128151 AssertionError: If the output does not match the baseline or baseline is missing
0 commit comments