litestar-org / litestar-org/pytest-databases
feat(gizmosql): expose backend-specific DuckDB and SQLite service fixtures
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 59
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
Summary
GizmoSQL supports both DuckDB and SQLite through the DATABASE_BACKEND container setting, but pytest-databases currently exposes only the backend-ambiguous gizmosql_service fixture. Consumers that need to exercise both backends must reimplement DockerService.run(), readiness checks, credentials, TLS settings, xdist naming, and teardown locally.
Proposed API
- Add
gizmosql_duckdb_service, explicitly configured withDATABASE_BACKEND=duckdb. - Add
gizmosql_sqlite_service, explicitly configured withDATABASE_BACKEND=sqlite. - Retain
gizmosql_serviceas a backward-compatible alias or wrapper forgizmosql_duckdb_service. - Reuse the existing image, username, password, and server-isolation fixtures rather than duplicating lifecycle code.
- Give each backend a distinct container name so both fixtures can be requested in one test session.
The backend-specific services should work with the clientless readiness approach in #141; no backend-specific connection fixture is required.
Motivation
The GizmoSQLService documentation describes DuckDB and SQLite backends, while the public fixture surface can provision only the implicit default. SQLSpec needs both backends for its Flight SQL adapter integration matrix and currently has to shadow the native gizmosql_service and hand-roll a second SQLite service. Backend-specific upstream fixtures would let consumers rely entirely on pytest-databases for container lifecycle, as intended.
Acceptance criteria
- Both backend fixtures can run independently and in the same pytest session.
- Each fixture sets
DATABASE_BACKENDexplicitly and uses a backend-specific container name. pytest -n 2remains isolated withxdist_gizmosql_isolation_level=server.- Existing users of
gizmosql_serviceretain DuckDB-default behavior. - Documentation lists the new fixtures and identifies the compatibility alias.
Version context
Observed in pytest-databases 0.19.0 and still present in the open #141 implementation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing gizmosql_service fixture and the clientless readiness approach in #141; inspect how DockerService.run(), credentials, TLS, teardown, and xdist isolation are currently wired. Add the two backend-specific fixtures while preserving the existing DuckDB behavior, then run pytest -n 2 and update the GizmoSQL fixture documentation to verify both services and the compatibility alias.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- databases, testing-qa, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100