Step-by-step guide for running the Amprealize test suite.
Quick Start
# Run all tests (serial, safest)
./scripts/run_tests.sh
# Run with 2 parallel workers (recommended for laptops)
./scripts/run_tests.sh -n 2
# Validate environment only (no tests)
./scripts/run_tests.sh --check-onlyUsing BreakerAmp
# Use BreakerAmp test environment
./scripts/run_tests.sh --breakeramp --env test
# Custom environment file
./scripts/run_tests.sh --breakeramp --env-file ./my-env.yamlRunning Specific Test Categories
# Unit tests only (fast, no external deps)
pytest -m unit
# Integration tests only
pytest -m integration
# Skip slow tests
pytest -m "not slow"
# Postgres-dependent tests only
pytest -m postgres
# Smoke tests (staging validation)
pytest -m smokeRunning with Kafka
# Enable Kafka module
./scripts/run_tests.sh --with-kafkaLegacy Per-Service Database Mode
# Use separate databases per service (legacy)
AMPREALIZE_TEST_PER_SERVICE_PG_DATABASES=1 ./scripts/run_tests.shCI Configuration
# Auto-detect cores, load-balanced by file
pytest -n auto --dist=loadfileTroubleshooting
Tests timing out
Default timeout is 60 seconds per test. If tests consistently time out:
- Check for missing
@pytest.mark.slowon long-running tests - Verify database connectivity (
--check-only) - Check container health:
podman ps
Database connection refused
- Ensure containers are running:
podman compose -f infra/docker-compose.test.yml up -d - Verify port availability:
lsof -i :6433 - Check modular vs. per-service mode matches your compose file
Coverage below threshold
Minimum coverage threshold is 70%. Check report:
pytest --cov=amprealize --cov-report=html
open htmlcov/index.html