Skip to content

test: complete test-suite overhaul (phases 1-7)#194

Merged
d-laub merged 81 commits into
mainfrom
worktree-test-suite-overhaul
May 25, 2026
Merged

test: complete test-suite overhaul (phases 1-7)#194
d-laub merged 81 commits into
mainfrom
worktree-test-suite-overhaul

Conversation

@d-laub
Copy link
Copy Markdown
Collaborator

@d-laub d-laub commented May 24, 2026

Summary

Completes the test-suite overhaul across all 7 phases. The tree is now split into a fast unit tier (no project fixtures) and an integration tier (real on-disk artifacts), with a CI job publishing coverage HTML on every PR.

  • Phase 1 (bootstrap): added pytest-cov config + test-cov pixi task; scaffolded tests/unit/, tests/integration/, tests/_builders/; relocated all existing tests under tests/integration/.
  • Phase 2 (conftest): centralized 17 session-scoped path fixtures in tests/conftest.py (ref_fasta, phased_{vcf,pgen,svar}_gvl, kg_*, source_*, issue_153_*, vcf_dir, pgen_dir, bigwig_dir, consensus_dir, filtered_svar); migrated every integration file to use them.
  • Phase 3 (audit): captured coverage baseline (63%); produced docs/superpowers/specs/2026-05-24-test-audit.md classifying 137 functions across 35 files (Delete: 5, Port: 77, Keep: 55).
  • Phase 4 (delete pass): removed dead/tautological/skip-only tests (test_filter_af.py, test_rs_indexing 147-case cross-product, test_interval_track.py, etc.).
  • Phase 5 (ports — by component):
    • Prelude + ragged builders (make_ragged_seqs, make_ragged_intervals)
    • Reconstruct (make_tracks builder + 19-test insertion-fill extraction)
    • Variants (info-fields + choose_exonic_variants)
    • Splice (get_splice_bed + RefDataset settings/validation)
    • SVAR-link (pydantic-model tests)
    • Utility (test_utils.py whole-file)
    • Tracks (broader): test_random_nonoverlapping + sibling utils.py, test_write_tracks atomic split (integration renamed _e2e for basename-collision avoidance), test_table.py whole-file
    • Ref/FASTA: session-scoped reference fixture promoted to conftest with docstring carve-out (metadata-only Reference is cheap); test_fasta.py + test_ref_ds.py whole-file moves
    • Dataset polymorphism (minimal): test_with_insertion_fill_rejects_when_no_tracks_active extracted; test_ds_indexing deferred (would require a speculative make_dataset builder — YAGNI)
  • Phase 6 (integration trim): systematic redundancy audit via Explore agent. Found zero strict redundancies — the audit's Port/Delete buckets already captured everything that could move. Closed with no deletions.
  • Phase 7 (CI coverage): new coverage job in .github/workflows/test.yaml runs test-cov on py312 in parallel with the pytest matrix; publishes htmlcov/ + coverage.xml as GHA artifacts on every PR and main push.

Final state

  • Unit tier: 167 passed, 2 xfailed (~3.2s)
  • Integration tier: 184 tests using real on-disk artifacts
  • Full non-slow suite: 351 passed, 3 skipped, 2 xfailed (62% line+branch coverage)
  • No production code modified.
  • Builders: tests/_builders/ exports make_ragged_seqs, make_ragged_intervals, make_tracks.
  • Deferred: make_dataset + test_ds_indexing port (no consumer beyond one test).

Test Plan

  • CI: existing pytest matrix (py310–py313) passes on every entry.
  • CI: new coverage job uploads htmlcov/ and coverage.xml artifacts.
  • Download htmlcov artifact from the CI run; spot-check the report renders.
  • Reviewer: skim docs/superpowers/specs/2026-05-24-test-suite-overhaul-status.md (living status snapshot) — "Notable decisions / gotchas" section captures the non-obvious choices (basename collisions, sibling-import preservation, conftest carve-out, etc.).

🤖 Generated with Claude Code

d-laub and others added 30 commits May 24, 2026 13:30
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Moves all test_*.py files and dataset/, tracks/, variants/ subdirs into
tests/integration/, preserving subdirectory structure. Increments
parents[N] and parent.parent depth references by one to account for the
extra nesting level; suite stays at 500 passed, 6 skipped, 3 deselected,
2 xfailed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Audit 35 integration test files (137 test functions) into Delete (5),
Port (77), and Keep-as-integration (55) buckets, with a polymorphism-gap
section covering 8 axes.  Gating document for Phases 4+ (delete pass,
unit builders, coverage trim).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
d-laub added 28 commits May 24, 2026 15:42
5 pure-utility tests (bed_to_regions, splits_sum_le_value,
normalize_contig_name) with no fixture dependencies. Whole-file
move per audit classification — all Port, zero Keep.

Phase 5 utility component of the test suite overhaul.
Both files move together to preserve the prepend-mode sibling import
(`from utils import nonoverlapping_intervals`). 4 parametrized cases;
no fixture dependencies; the tested helper is itself a test utility,
not library code.

Phase 5 tracks (broader) component.
Move test_write_duplicate_track_names_rejected to
tests/unit/dataset/test_write_tracks.py (port: input validation
fires before disk I/O). Rename the integration file to
test_write_tracks_e2e.py to avoid the pytest prepend-mode basename
collision (precedent: reconstruct plan).

Phase 5 tracks (broader) component.
12 Table tests (init, column_map, from_path format dispatch,
count_intervals kernel, contig normalization). All audit-Port, zero
Keep. tmp_path is the only fixture used; no project scaffolding.

Phase 5 tracks (broader) component — final file.
Add session-scoped reference fixture to tests/conftest.py. Two
existing files (test_ref_ds_splicing, test_ref_ds_splice_settings)
duplicated the same Reference.from_path(..., in_memory=False)
construction; both now consume the conftest fixture. Convention
carve-out documented in the fixture docstring — metadata-only
construction is cheap enough to warrant centralization.

Phase 5 ref/fasta component — fixture pre-work.
3 Fasta.read pad/no-pad boundary tests. Audit-Port whole-file move;
only ref_fasta fixture used (already in conftest); no basename
collision.

Phase 5 ref/fasta component.
2 remaining audit-Port tests (test_getitem, test_padded_slice) move
whole-file to tests/unit/dataset/. The local reference fixture is
deleted in favor of the conftest fixture promoted in the previous
commit. Tidy the pytest_cases import (fixture no longer needed).

Phase 5 ref/fasta component — final move.
Follow-up to 8eafb36 — the prior commit landed the rename only;
pre-commit's working-tree stash hid the fixture-drop edits. This
commit removes the duplicate `reference` fixture from the moved
file and tidies the unused `pytest_cases.fixture` import. The
moved tests pick up the conftest fixture by name.
Move test_with_insertion_fill_rejects_when_no_tracks_active to
tests/unit/dataset/test_with_insertion_fill.py. The test uses
gvl.get_dummy_dataset() (gvl-shipped helper, not a project toy-
dataset fixture) and only checks API-level rejection behavior.
The 2 remaining tests in the integration file exercise the full
reconstruction call path and stay in integration.

Phase 5 dataset polymorphism component — minimal scope (test_ds_indexing
deferred pending a make_dataset consumer; see status doc).
Explore-agent systematic comparison of every remaining integration
test against the unit tier found zero strict redundancies. The
audit's Port/Delete buckets already captured everything that could
move; remaining Keeps exercise write→read roundtrips, byte-comparison
against real FASTA, or full reconstruction call paths that no unit
test covers.

Last component before the overhaul is done: Phase 7 (htmlcov CI
upload).
Runs the existing test-cov pixi task on py312 in parallel with the
pytest matrix. Publishes htmlcov/ and coverage.xml as separate
GitHub Actions artifacts; both upload with if-no-files-found=error
so a silently-empty artifact never lands.

Closes the test-suite-overhaul Phase 7 (CI report).
@d-laub d-laub changed the title test: phases 1-3 of test suite overhaul — relocate + audit test: complete test-suite overhaul (phases 1-7) May 25, 2026
@d-laub d-laub merged commit 280e06e into main May 25, 2026
7 checks passed
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