sprint: make Day-4 tests self-sufficient — 31/31 in CI without DVC data - #31
Merged
Merged
Conversation
…st_api.py + tmp_path CSVs in test_data_loader.py (Day 7 CI hardening) — drops the requires_data marker dependency; full 31/31 suite now runs in CI without DVC data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Replaces the previous "mark and skip" workaround (#30) with a proper fix: the Day-4 tests now construct synthetic fixtures instead of loading the real DVC-tracked artifacts. All 31 tests run in CI on a hermetic runner; nothing is deselected.
Before vs after
```
Before (#30): mark-and-skip
$ pytest tests/ -q -m "not requires_data"
26 passed, 5 deselected
```
```
Now: synthetic fixtures
$ pytest tests/ -q -m "not requires_data"
31 passed, 0 deselected
```
How
`tests/test_api.py`
The original fixture called `create_app()` with no args, which forced the FastAPI app to load `models/fraud_model.pkl` from disk. The rewrite:
The four /healthz, /predict (valid), /predict (empty rejection), /metrics/predictions tests now run against the synthetic model.
`tests/test_data_loader.py`
`test_loader_reads_x_test_and_y_test` previously called `SentinelDataLoader()` with no args, which read from `data/processed/X_test.csv` via params.yaml. The rewrite:
The two other tests in the file (`test_loader_resolves_paths_from_params`, `test_dvc_status_is_safe_without_dvc`) were already self-sufficient and are unchanged.
Marker hygiene
`tests/conftest.py` still registers the `requires_data` marker, even though no test currently uses it -- it stays available for `tests/synthetic_drift.py` (the 30-day replay script that genuinely needs the full `data/processed/features.csv`) and any future genuinely-dataset-bound tests.
Verification
Result vs the original problem
#28 (Day 7 production wrap) added CI but exposed two latent issues. #29 fixed the install step (yanked protobuf). #30 was a defensive marker that skipped 5 tests. This PR removes the skip -- every test ships green on every push.