Skip to content

Local Development

Schema File Mode

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:

Terminal window
pip install "sqlproof[testcontainers]"

Docker must be running when using testcontainers.

Local Postgres

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

Terminal window
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.

Pytest

SqlProof tests run with normal pytest:

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

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