DynaStore's test suite expects a PostgreSQL instance reachable at postgresql://testuser:testpassword@localhost:54320/gis_dev. The simplest path is the bundled docker-compose stack; the Makefile wraps it.
- Docker (Compose v2 plugin)
- Python 3.12 + project virtualenv at
.venv/ - Test dependencies installed:
pip install -e '.[dev]'
make db-up # start postgres on 127.0.0.1:54320 and wait for readiness
make test # run unit + integration suite
make db-down # stop and drop the volume when finishedmake test depends on db-up, so a fresh checkout only needs make test. make db-down drops the volume — destructive, but the only way to reset between schema changes during development.
make test-unit # unit tests only; no database required for the bulk of them
make test-integration # integration tests only (requires db-up)
make test-coverage # full suite + HTML coverage at htmlcov/index.htmlFor ad-hoc invocations bypass the Makefile:
.venv/bin/pytest tests/dynastore/extensions/stac/integration/test_stac_put_replace.py -vvIf you already run a local PostgreSQL on :54320:
createdb -h localhost -p 54320 -U testuser gis_dev
.venv/bin/pytest tests -vvThe schema is created on demand by tests/conftest.py::pytest_sessionstart. The user testuser must own gis_dev so xdist workers can clone it into per-worker template databases (gis_dev_gw0, gis_dev_gw1, …) under an advisory lock.
Tests run with -n auto --dist worksteal by default. Per-worker databases are cloned from gis_dev at session start; an advisory lock (pg_advisory_lock(8472001)) serializes the clones. If you see ObjectInUseError: source database "gis_dev" is being accessed by other users, a previous run left connections open — make db-down && make db-up resets cleanly.
To disable parallelism (useful when stepping through with --pdb):
.venv/bin/pytest tests -p no:xdist -o "addopts=" --pdbOptional and advisory-only in CI. To run locally, bring up the ES stack alongside the database:
docker compose -f packages/core/src/dynastore/docker/docker-compose.yml up -d db elasticsearch
.venv/bin/pytest tests/dynastore/modules/elasticsearch/integration -vv| Symptom | Likely cause | Fix |
|---|---|---|
connection refused on :54320 |
DB not started | make db-up |
source database "gis_dev" is being accessed |
leftover xdist connections | make db-down && make db-up |
| Tests pass locally but fail in CI | docker image lag | rebuild with docker compose build db |
pyright: ... errors but no test failure |
typecheck only | .venv/bin/pyright packages/ |
Ruff is not in .venv/; run via uv tool run ruff check <files>. Pyright is at .venv/bin/pyright.