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)
For environment setup, see Setup Guide
- 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
- 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 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)- All new code should include tests
- Aim for high coverage, but prioritize meaningful tests
- 90% is the minimum coverage threshold (CI will fail otherwise)