Skip to content

Fix flaky CI: pin shared test snp fixtures to installed Ensembl release 81 - #400

Merged
iskandr merged 1 commit into
mainfrom
pin-test-fixtures-release-81
Jul 9, 2026
Merged

Fix flaky CI: pin shared test snp fixtures to installed Ensembl release 81#400
iskandr merged 1 commit into
mainfrom
pin-test-fixtures-release-81

Conversation

@iskandr

@iskandr iskandr commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Problem

tests/test_collection_filtering.py calls variants.effects() at module import on the db_snp_variants fixtures defined in tests/data.py. Those Variants defaulted to reference_name="GRCh38", which pyensembl resolves to its latest known release (currently 115) rather than an installed one.

CI installs GRCh38 from the openvax/ensembl-data mirror, which tops out at GRCh38.95. So whenever the latest-release GTF isn't present, collection of that module dies with "GTF database needs to be created" — an intermittent failure on main's default ./test.sh run (seen on 3.9/3.10).

This is the same class of latent release-dependency bug fixed in #399, at a call site that PR didn't touch.

Fix

Pin the three shared snps to cached_release(81) — the installed release the downstream transcript-id assertions (ENST00000371321, ...371763, ...464755, ...613244) were already written against. Test-only, no library changes.

Verification

  • test_collection_filtering.py → 7 passed (including the expression test that fails under release 115)
  • test_cli_genes.py → 1 passed
  • ruff check tests/data.py → clean
  • Swept every other module-level .effects() call site: the MAF fixtures (tcga_ov, ov_wustle) resolve to GRCh37/release 75, which is installed — no further trap.

https://claude.ai/code/session_01VNtZRyKZ7u9jiMGPQEbx4c

test_collection_filtering.py calls variants.effects() at module import
using the db_snp_variants fixtures from tests/data.py. Those Variants
defaulted to reference_name "GRCh38", which pyensembl resolves to its
LATEST known release (currently 115) rather than an installed one. The
CI mirror (openvax/ensembl-data) tops out at GRCh38.95, so collection
intermittently died with "GTF database needs to be created" whenever
the latest-release GTF wasn't present -- a pre-existing flake on main's
default run, not something the annotator switch introduced.

Pin the three snps to cached_release(81) -- the installed release the
downstream transcript-id assertions (ENST00000371321, ...371763,
...464755, ...613244) were written against. Same class of fix as #399.
@iskandr
iskandr merged commit 6faf774 into main Jul 9, 2026
2 of 8 checks passed
@iskandr
iskandr deleted the pin-test-fixtures-release-81 branch July 9, 2026 00:24
iskandr added a commit that referenced this pull request Jul 9, 2026
A bare reference name like Variant(..., "GRCh38") or
from_csv(genome="GRCh38") resolves, via pyensembl, to the latest
release pyensembl KNOWS about (currently 115), not one that's
necessarily downloaded. CI installs GRCh38 only up to release 95 (the
openvax/ensembl-data mirror tops out there), so dozens of tests across
the suite would try to auto-fetch release 115 from Ensembl's FTP at
runtime. When that FTP is slow/unreachable the whole job fails with
"GTF database needs to be created, run: pyensembl install --release 115"
-- an intermittent, whole-suite flake (seen here on 3.11; the previous
run passed only because the auto-download happened to succeed).

conftest now transparently caps GRCh38 string resolution at the newest
release whose GTF index actually exists on disk, walking down from the
resolved release and flooring at 76 (the first GRCh38 release) so it
never crosses into GRCh37. Verified: the full suite passes identically
under release 95 and 115 (1235 passed, both fast and protein_diff), so
this only removes the network dependency -- no expected value changes.
Library behavior is untouched; this lives entirely in the test harness.

Complements the import-time fix in #400 (data.py snps), covering the
remaining runtime bare-"GRCh38" call sites.
iskandr added a commit that referenced this pull request Jul 9, 2026
Two call sites resolved to pyensembl's latest known release via paths
that bypass the conftest GRCh38 cap (which only intercepts varcode's
string resolution):

- test_variant.py imported pyensembl's module-level `ensembl_grch38`
  (its latest release, 115) directly. Pin to cached_release(81), matching
  the convention used across the rest of the suite. test_serialization
  asserts only roundtrip consistency, not a release number, so no
  expected value changes.

- test_effect_classes.py built mouse_genome via
  genome_for_reference_name("grcm38"), which resolves to GRCm38 release
  102; CI installs GRCm38.95. Pin to cached_release(95, species="mouse").
  The asserted transcript (ENSMUST00000021049 / Psmc5) is identical
  across releases 95 and 102, so the effect assertion is unchanged.

Completes the sweep of runtime latest-release dependencies alongside the
conftest cap and #400.
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