Skip to content

Commit 91e45c2

Browse files
committed
fix: Handle flaky test_pairwise_average_fst_with_sample_query
Random taxon + admin2_month cohort selection can produce zero valid cohorts for small simulated datasets. Skip gracefully instead of failing when ValueError('No cohorts remain') is raised.
1 parent 2bde580 commit 91e45c2

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

tests/anoph/test_fst.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,16 @@ def test_pairwise_average_fst_with_sample_query(fixture, api: AnophelesFstAnalys
346346
n_jack=random.randint(10, 200),
347347
)
348348

349-
# Run checks.
350-
check_pairwise_average_fst(api=api, fst_params=fst_params)
349+
# Run checks - skip if random parameter selection results in insufficient cohorts.
350+
try:
351+
check_pairwise_average_fst(api=api, fst_params=fst_params)
352+
except ValueError as e:
353+
if "No cohorts remain" in str(e):
354+
pytest.skip(
355+
f"Skipping: random parameter selection produced insufficient "
356+
f"cohorts for taxon={taxon!r}: {e}"
357+
)
358+
raise
351359

352360

353361
@parametrize_with_cases("fixture,api", cases=".")

0 commit comments

Comments
 (0)