Skip to content

Local Development

The easiest local setup is a schema file:

from sqlproof import SqlProof

proof = SqlProof.from_schema_file("./schema.sql")

SqlProof can manage disposable Postgres instances through the optional testcontainers extra:

pip install "sqlproof[testcontainers]"

Docker must be running when using testcontainers.

If you already run Postgres locally, point SqlProof at a test database:

export DATABASE_URL=postgresql://postgres:test@localhost:5432/postgres
import os
from sqlproof import SqlProof

proof = SqlProof.from_connection_string(os.environ["DATABASE_URL"])

Use a dedicated development or CI database. Never run generated-data tests against production.

SqlProof tests run with normal pytest:

pytest
pytest --sqlproof-runs=200
pytest --sqlproof-seed=1708891234

The pytest plugin is auto-discovered from the installed package and adds the --sqlproof-* options.