Skip to content

Skip engine-backed head-to-head scorer tests without the us extra - #817

Open
MaxGhenis wants to merge 1 commit into
mainfrom
skip-scorer-tests-without-us-extra
Open

Skip engine-backed head-to-head scorer tests without the us extra#817
MaxGhenis wants to merge 1 commit into
mainfrom
skip-scorer-tests-without-us-extra

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

What

Adds the registered requires_us marker to the four tests in packages/microcosm-build/tests/test_us_release_head_to_head_scorer.py that load real H5 fixtures through module.load_artifact:

  • test_incumbent_and_candidate_h5_loaders_preserve_scored_contract
  • test_historical_formula_owned_h5_scores_with_drop_receipt
  • test_historical_formula_owned_h5_refuses_missing_leaf
  • test_clean_historical_h5_scores_with_empty_drop_receipt

Why

Under a no-extras sync (uv sync --all-packages, no --extra us) these tests run and fail instead of skipping. load_artifact_load_h5release._load_frame does from policyengine_us.data import USSingleYearDataset at call time (tools/build_us_fiscal_refresh_release.py:2607), which raises ModuleNotFoundError when the extra is absent. Their existing pytest.importorskip("tables") guard covers pytables only, not the engine.

Per CLAUDE.md, engine-gated tests must skip via the registered requires_us/requires_uk markers (the root conftest collection hook) or an existing importorskip guard. The marker is the prescribed form for newly guarded tests.

The report that prompted this named three tests; test_incumbent_and_candidate_h5_loaders_preserve_scored_contract fails identically (same load_artifact path), so it gets the same marker.

Verification

  • No-extras sync: was 4 failed, 12 passed; now 12 passed, 4 skipped with reason "requires policyengine-us extra"
  • uv sync --all-packages --extra us: 16 passed
  • uv run ruff check clean; uv run python tools/ci_test_groups.py --verifyverification=ok
  • Not touched: a pre-existing ruff format divergence at line ~181 of this file (present on main; CI runs ruff check only)

🤖 Generated with Claude Code

The four tests that call load_artifact on real H5 fixtures reach
release._load_frame, which imports policyengine_us.data at call time,
so under a no-extras sync they failed instead of skipping. The
registered requires_us marker lets the root collection hook skip them
when the engine is absent, per the engine-gated test convention.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant