Skip to content

CI: test_info_gene is flaky — exact-match assertion over best-effort UniProt/NCBI enrichment #267

Description

@Elarwei001

Summary

tests/test_info.py::TestInfo::test_info_gene fails intermittently — not because of a permanent upstream change, but because it asserts an exact full row that includes gget info's best-effort UniProt + NCBI enrichment, which gget info silently drops when those services hiccup.

Evidence it's flaky (not a fixed drift)

In a single CI run (on an unrelated PR, #266), the same code + same fixture gave:

  • py3.12 ✅ pass, py3.13 ✅ pass, py3.14 ❌ fail.

A permanent output change would fail on all three Python versions. Only one failing → non-deterministic.

The failing assertion (py3.14):

FAILED tests/test_info.py::TestInfo::test_info_gene
  actual   = [ 'EnsMUSG00000000001.6',            'mus_musculus', 'GRCm39', 'Gnai3', ... ]
  expected = [ 'EnsMUSG00000000001.6', 'Q9DC51', '14679', 'mus_musculus', 'GRCm39', 'Gnai3', ... ]

The actual row is missing Q9DC51 (UniProt ID) and 14679 (NCBI gene ID) — the UniProt/NCBI enrichment returned nothing on that run.

Root cause

gget.info(..., ncbi=True, uniprot=True) (the defaults) fetches UniProt/NCBI as best-effort: the calls are wrapped in try/except Exception (e.g. in gget/gget_info.py, around the get_uniprot_info(...) call), so a timeout/hiccup is swallowed and the corresponding columns are dropped. The test_info.json fixture, however, encodes a row that includes those enriched fields, so the exact-equality assertion fails whenever the enrichment doesn't come back.

Suggested fix

Make the test robust to the optional, network-dependent enrichment instead of pinning the exact enriched row:

  • Assert the stable Ensembl-derived columns (ensembl_id, species, assembly, symbol, biotype, chromosome, start/end, description) and treat the UniProt/NCBI-derived fields as optional (assert only when present); or
  • Run test_info_gene with ncbi=False, uniprot=False for the deterministic assertion, and cover the enrichment separately in a tolerant/skippable test.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions