Skip to content

Commit ee02021

Browse files
igerberclaude
andcommitted
Skip golden-value tests when file absent (CI isolated-install fix)
CI's "Copy tests to isolated location" step runs tests against the installed package from /private/tmp/tests/, but does NOT copy benchmarks/ alongside. My parity tests hard-failed with FileNotFoundError when the golden JSON was not present at the expected relative path. Follow the established repo convention for golden-value fixtures: if not GOLDEN_PATH.exists(): pytest.skip("Golden values file not found; run: Rscript ...") Matches the pattern used by test_csdid_ported.py, test_chaisemartin_dhaultfoeuille_parity.py, test_survey_real_data.py, test_survey_estimator_validation.py, and test_linalg_hc2_bm.py. Parity tests still run as hard gates: - when invoked from the repo root (local /pre-merge-check, /ai-review-local, dev iteration) - when benchmarks/ is present alongside tests/ in CI jobs They skip in the isolated-install job where only tests/ is copied. Net effect matches the shipping convention for all other R-backed parity suites in this repo. 190 tests pass (unchanged). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 795b461 commit ee02021

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

tests/test_bandwidth_selector.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@
3232

3333
@pytest.fixture(scope="module")
3434
def golden():
35+
"""Load R-generated nprobust golden values. Skip if the file is
36+
absent (e.g. in CI's isolated-install path where benchmarks/ is
37+
not copied alongside tests/)."""
38+
if not GOLDEN_PATH.exists():
39+
pytest.skip(
40+
"Golden values file not found; "
41+
"run: Rscript benchmarks/R/generate_nprobust_golden.R"
42+
)
3543
with GOLDEN_PATH.open() as f:
3644
return json.load(f)
3745

tests/test_nprobust_port.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ def _setup(self):
141141
/ "data"
142142
/ "nprobust_mse_dpi_golden.json"
143143
)
144+
if not golden_path.exists():
145+
pytest.skip(
146+
"Golden values file not found; "
147+
"run: Rscript benchmarks/R/generate_nprobust_golden.R"
148+
)
144149
with golden_path.open() as f:
145150
golden = json.load(f)
146151
dgp = golden["dgp1"]

0 commit comments

Comments
 (0)