Skip to content

sprint: mark data-dependent Day-4 tests with requires_data (Day 7 CI fix) - #30

Merged
Mark007-R merged 1 commit into
devfrom
sprint/day07-ci-mark-data-tests
May 24, 2026
Merged

Mark007-R merged 1 commit into
devfrom
sprint/day07-ci-mark-data-tests

Conversation

@Mark007-R

Copy link
Copy Markdown
Owner

What

Day 7 CI (added in #28) had two breakages from the same root cause: tests written before CI existed assumed the developer's local DVC state. PR #29 unblocked the install step (yanked protobuf). This PR unblocks the unit test step.

`pytest tests/` fails on CI because:

  • `tests/test_api.py` boots the FastAPI app, which loads `models/fraud_model.pkl` and `data/processed/X_test.csv` -- both DVC-tracked, not in git.
  • `tests/test_data_loader.py::test_loader_reads_x_test_and_y_test` reads the same two CSVs.

Fix

The CI workflow command already uses `-m "not requires_data"` to skip data-dependent tests -- the tests just weren't marked. This PR:

  1. Adds `tests/conftest.py` registering the `requires_data` marker (so pytest doesn't warn about an unknown marker).
  2. Tags `tests/test_api.py` at module level via `pytestmark = pytest.mark.requires_data` -- the whole file needs the model.
  3. Tags only `test_loader_reads_x_test_and_y_test` in `tests/test_data_loader.py` -- the other two tests in the file (path resolution + dvc_status safe path) don't touch data and stay in CI.

Result

```
$ pytest tests/ -q -m "not requires_data" --ignore=tests/synthetic_drift.py
26 passed, 5 deselected in 76.74s
```

The 26 CI-runnable tests now cover: temporal-split regression guard, Pandas/Dask determinism, KS+PSI behaviour, registry promote/rollback end-to-end, retrain debounce, telemetry round-trips, loader path resolution, and DVC-status safe fallback.

The 5 deselected tests (`test_api.py` x4 + `test_loader_reads_x_test_and_y_test` x1) still run locally after `dvc repro train`.

Files touched

  • `tests/conftest.py` (new, 18 lines) -- marker registration.
  • `tests/test_api.py` -- 5-line comment + `pytestmark = pytest.mark.requires_data`.
  • `tests/test_data_loader.py` -- import pytest + 1-line marker on the data-reading test.

No production code changes.

…fix) — test_api needs models/fraud_model.pkl, test_loader_reads_x_test_and_y_test needs data/processed/*.csv; both DVC-tracked, not in git; CI's -m 'not requires_data' now finds the marker via tests/conftest.py
Copilot AI review requested due to automatic review settings May 24, 2026 07:56
@Mark007-R
Mark007-R merged commit fcfd05b into dev May 24, 2026
1 of 2 checks passed
@Mark007-R
Mark007-R deleted the sprint/day07-ci-mark-data-tests branch May 24, 2026 07:56
@Mark007-R
Mark007-R removed the request for review from Copilot May 24, 2026 08:19
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