Shared test rules live in standards/unittests.md. This document covers repository-specific testing behavior only.
The repository has two main test layers:
- Unit tests under
tests/unit/for transport, models, resources, and the RQL builder - End-to-end tests under
tests/e2e/for live API coverage
make test runs the unit suite by default. E2E tests are opt-in and require live credentials.
Run all test commands through Docker-based make targets:
make test
make test args="tests/unit/http"
make test args="tests/e2e"
make check
make check-allRepository command mapping:
make testrunspytestagainsttests/unitunlessargsoverrides the pathmake checkrunsruff format --check,ruff check,flake8,mypy, anduv lock --checkmake check-allruns bothcheckandtest
- Source:
mpt_api_client/ - Reports: terminal (missing lines) + XML (
coverage.xml) - Branch coverage enabled
__init__.pyfiles omitted from coverage reports
Results are reported to SonarCloud via sonar-project.properties.
Repository-specific pytest settings live in pyproject.toml, including:
- discovery under
tests - repository root on
pythonpath - import mode
importlib - async fixture loop scope and warning filters
- E2E suites require configured MPT credentials and optional ReportPortal settings; see e2e_tests.md.
- Keep live API coverage in
tests/e2e/separate from unit-only behavior intests/unit/. - When changing public client behavior, service mixins, resource modules, or query building, update the matching unit coverage.