Note
This file is maintained by the foundry-python template and will be updated when you run mise run update_from_template.
Every test MUST have a category marker. Tests without markers won't run in CI.
| Marker | Command | Purpose |
|---|---|---|
@pytest.mark.unit |
mise run test_unit |
Isolated tests, all dependencies mocked, must pass offline |
@pytest.mark.integration |
mise run test_integration |
Real local services (Docker), mocked external APIs |
@pytest.mark.e2e |
mise run test_e2e |
Real external services, full workflows |
@pytest.mark.scheduled |
mise run test_scheduled |
Tests run on schedule (also included in regular runs) |
@pytest.mark.sequential |
mise run test_sequential |
Tests excluded from parallel execution |
# By category
mise run test_unit # Fast, isolated (serial execution)
mise run test_integration # Real services (20% parallel)
mise run test_e2e # Full parallel
# All tests
mise run test # Runs unit → integration → e2e
# Specific test
pytest tests/path/to/test.py::test_function -vControlled by XDIST_WORKER_FACTOR environment variable:
| Test Type | Factor | Behavior |
|---|---|---|
| Unit | 0.0 | Serial (parallelization overhead > benefit) |
| Integration | 0.2 | 20% of logical CPUs |
| E2E | 1.0 | 100% of logical CPUs (I/O bound) |
- Goal: 100%
- Minimum: 85%
- Reports:
reports/coverage.xml,reports/coverage.md,reports/coverage_html/
Tests run in randomized order via pytest-randomly to surface hidden ordering dependencies between tests.
pytest --collect-only -m "not unit and not integration and not e2e" -q| Task | Description |
|---|---|
mise run test |
Run all tests (unit → integration → e2e) |
mise run test_unit |
Unit tests only (serial) |
mise run test_integration |
Integration tests (20% parallel) |
mise run test_e2e |
E2E tests (full parallel) |
mise run test_scheduled |
Scheduled tests only |
mise run test_sequential |
Non-parallelizable tests |
mise run test_coverage_reset |
Clear coverage data |