Skip to content

Reorganize tests and improve coverage #61

Description

@Presmanes3

Problem

Tests are flat and minimal: 4 test files, basic structure, low coverage. No test organization mirrors the source structure.

Current:

tests/
├── conftest.py
├── test_api.py
├── test_models.py
├── test_pipeline.py
└── workers/test_alert_delivery.py

Proposed solution

Reorganize tests to mirror src/ structure and add comprehensive coverage:

tests/
├── conftest.py              # Shared fixtures
├── api/
│   ├── conftest.py          # TestClient fixture
│   ├── test_health.py
│   ├── test_runs.py
│   ├── test_predict.py
│   └── test_organizations.py
├── repositories/
│   ├── conftest.py      # Test DB (in-memory SQLite)
│   └── test_run_repository.py
├── analysis/
│   └── test_analysis_types.py
└── workers/test_alert_delivery.py

Tasks

  • [ ] Restructure test directory to mirror src/ layout
  • [ ] Add database fixtures (in-memory SQLite) for repository tests
  • [ ] Add tests for each route group (health, runs, predict, orgs, alerts)
  • [ ] Add tests for analysis type registry
  • [ ] Add tests for repositories (CRUD operations)
  • [ ] Achieve minimum 70% code coverage
  • [ ] Add pytest-cov to CI workflow
  • [ ] Add test documentation in CONTRIBUTING.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions