Skip to content

Latest commit

 

History

History
59 lines (40 loc) · 1.49 KB

File metadata and controls

59 lines (40 loc) · 1.49 KB

Testing Guide

This document describes the testing strategy, conventions, and instructions for this ML project.

Note: Most of the tests currently found in the repo were AI-generated (with careful prompting) Note: the following directories are tested: ml/, pipelines/, ml_service, scripts/ (excluding fake data generator)

Environment Setup

For environment setup, see Setup Guide

Test Types

  • Unit tests: tests/unit/ – small, isolated functions or classes
  • Integration tests: tests/integration/ – interactions between modules
  • End-to-end tests: tests/e2e/ – full workflow

Note: the repo mostly contains unit tests, but they properly cover the vast majority of the targeted code

Running Tests

  • Use pytest:
pytest
  • For single folder/group testing (example):
pytest ./tests/unit/
  • For multiple folders/groups testing (example):
pytest ./tests/e2e/ ./tests/integration/
  • For single module testing (example):
pytest ./tests/unit/cli/test_error_handling_exit_codes.py

Coverage

  • Coverage reports are generated by GitHub Actions for every relevant commit - inspect the tests section.
  • Generate the report locally:
coverage run -m pytest
coverage report -m -i
coverage xml # optional (generates an xml file)

Quality Expectations

  • All new code should include tests
  • Aim for high coverage, but prioritize meaningful tests
  • 90% is the minimum coverage threshold (CI will fail otherwise)