Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""Pytest configuration -- shared markers for the Sentinel test suite.

Day 7 Phase 6 (2026-05-24). The CI workflow at .github/workflows/ci.yml runs
`pytest tests/ -m "not requires_data"` so the GitHub runner skips tests that
need the DVC-tracked data and trained model artifacts (which are not in git).
This conftest registers the `requires_data` marker so pytest does not emit a
PytestUnknownMarkWarning when the marker is used.
"""

from __future__ import annotations


def pytest_configure(config) -> None:
config.addinivalue_line(
"markers",
"requires_data: test depends on DVC-tracked data and/or the trained "
"model artifact in models/. Skipped in CI; run locally after "
"`dvc repro train`.",
)
7 changes: 7 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
from fastapi.testclient import TestClient


# The FastAPI app boots from models/fraud_model.pkl + data/processed/X_test.csv,
# neither of which is in git -- they come from `dvc repro train`. CI skips this
# whole module via the `-m "not requires_data"` marker filter; run locally
# after a successful pipeline run.
pytestmark = pytest.mark.requires_data


@pytest.fixture(scope="module")
def client(tmp_path_factory: pytest.TempPathFactory) -> TestClient:
tmp_dir = tmp_path_factory.mktemp("api-test")
Expand Down
3 changes: 3 additions & 0 deletions tests/test_data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path

import pandas as pd
import pytest

from src.data.loader import LoaderConfig, SentinelDataLoader, dvc_status

Expand All @@ -17,6 +18,8 @@ def test_loader_resolves_paths_from_params() -> None:
assert paths.model.name == "fraud_model.pkl"


# Reads data/processed/X_test.csv + y_test.csv which are not in git (DVC).
@pytest.mark.requires_data
def test_loader_reads_x_test_and_y_test() -> None:
loader = SentinelDataLoader()
X = loader.load_x_test()
Expand Down
Loading