Skip to content

Commit abe874d

Browse files
igerberclaude
andcommitted
CI fix: skip plot-source test on isolated-install CI
`test_event_study_plot_uses_stored_pointwise_ci_endpoints` imported `nbformat` and read the notebook from the repo's `docs/tutorials/` directory. CI Python Tests run from `/tmp/tests/` (isolated install of the wheel, no repo-tree access) and don't include nbformat in the runtime deps, so the test errored: ModuleNotFoundError: No module named 'nbformat' tests/test_t22_had_survey_design_drift.py:409 Two guards added (per `feedback_golden_file_pytest_skip` — same pattern that benchmarks/data/*.json drift tests use): 1. `nbformat = pytest.importorskip("nbformat")` — skips when the optional dep is missing. 2. `if not nb_path.exists(): pytest.skip(...)` — skips on the isolated-install matrix where docs/ isn't copied alongside tests/. The test runs in any environment that has both nbformat and the repo tree (dev workspace + tutorial-exec CI workflows), which is where it actually adds value. The Python Tests matrix doesn't need to lock notebook source against the prose/code mismatch the test was added to prevent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f7a716a commit abe874d

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

tests/test_t22_had_survey_design_drift.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,18 @@ def test_event_study_plot_uses_stored_pointwise_ci_endpoints():
404404
405405
This is a static check on the notebook source — the plot cell
406406
runs but produces no return value we can introspect, so we lock
407-
the construction at the source level."""
407+
the construction at the source level. Skipped on isolated-install
408+
CI jobs where ``docs/`` is not copied alongside ``tests/`` and
409+
``nbformat`` is not in the runtime deps (per
410+
``feedback_golden_file_pytest_skip``)."""
408411
from pathlib import Path
409-
import nbformat
412+
nbformat = pytest.importorskip("nbformat")
410413

411414
nb_path = (
412415
Path(__file__).resolve().parents[1] / "docs" / "tutorials" / "22_had_survey_design.ipynb"
413416
)
417+
if not nb_path.exists():
418+
pytest.skip(f"Notebook not present at {nb_path} (isolated-install CI)")
414419
nb = nbformat.read(nb_path, as_version=4)
415420
plot_cell_src = None
416421
for cell in nb.cells:

0 commit comments

Comments
 (0)