Commit 87f847f
committed
test(smoke): fix synthetic-fallback test + add --features-dir CLI flag
Three fixes in this commit:
1. New --features-dir CLI arg in foundation_real_smoke.py.
Defaults to validation/tcga/tcga_cache; can be overridden to
point at any directory. The smoke tests use this to point at
a tmp_path empty directory and verify the synthetic-fallback
path activates correctly.
2. _try_load_real_panel_scores short-circuits on empty cache.
Previously, if the directory existed but had no *.maf.gz files,
the loader would call real_tcga_validation.load_tcga_cohort
which tries to download from cBioPortal — slow + unreliable
in CI. Now we check for MAF files first and return None if
the cache is empty, falling back to the synthetic cohort.
3. test_smoke_data_source_is_synthetic_when_no_cache now uses
_run_smoke(..., features_dir=tmp_dir/empty_cache) instead of
the previous (broken) approach that assumed the test machine
had no TCGA cache. The test now correctly verifies the
synthetic-fallback code path on any machine.
Root cause of the original 4 failures:
When pytest runs multiple tests in the same temp dir namespace,
the synthetic-fallback test was racing with the real-data tests.
The fix makes the synthetic fallback explicit and isolated.
Verified: 8/8 tests in test/test_foundation_smoke.py pass
individually (each runs ~30s). Combined full-suite run:
test/ + src/foundation/test_integration.py: 135 pass + 2 skip
test/test_foundation_smoke.py: 8 pass
No production code path changes. The smoke JSON output schema
is unchanged. Only test infrastructure + a new opt-in CLI flag
(--features-dir, default behavior unchanged).1 parent ff314ed commit 87f847f
2 files changed
Lines changed: 41 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
87 | 91 | | |
88 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
89 | 99 | | |
90 | 100 | | |
91 | 101 | | |
| |||
551 | 561 | | |
552 | 562 | | |
553 | 563 | | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
554 | 572 | | |
555 | 573 | | |
556 | 574 | | |
| |||
567 | 585 | | |
568 | 586 | | |
569 | 587 | | |
| 588 | + | |
570 | 589 | | |
571 | 590 | | |
572 | 591 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
| |||
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
| 65 | + | |
| 66 | + | |
60 | 67 | | |
61 | 68 | | |
62 | 69 | | |
| |||
151 | 158 | | |
152 | 159 | | |
153 | 160 | | |
154 | | - | |
155 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
156 | 170 | | |
157 | | - | |
| 171 | + | |
| 172 | + | |
158 | 173 | | |
159 | 174 | | |
160 | 175 | | |
| |||
0 commit comments