Skip to content

Route tests by dialect marks and isolate test databases - #75

Open
nicoloesch wants to merge 3 commits into
mainfrom
74-test-conventions
Open

nicoloesch wants to merge 3 commits into
mainfrom
74-test-conventions

Conversation

@nicoloesch

@nicoloesch nicoloesch commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Note The oa-configurator constraint is raised to >=3.0.0,<4 by #76. Merge that first and rebase this branch. Once orm-loader is released, bump its constraint in pyproject.toml to the release that contains AustralianCancerDataNetwork/orm-loader#49 and refresh uv.lock with uv lock. The tests use require_routing_mark, which only exists in the new oa-configurator, so CI fails until then.

Summary

  • Removes db_dialect from addopts and the tests. Database-backed tests carry their dialect mark, which decides the CI job, and --strict-markers is set.
  • The session-scoped engine stays, and the function-scoped session on top of it calls require_routing_mark, so a test without the sqlite mark fails at setup.
  • Dialect-parametrized tests use DIALECT_PARAMS through dialect_session, with a duckdb_session fixture added for DuckDB.
  • The vocabulary source loader tests are split into a SQLite and a PostgreSQL test, and pytest.importorskip is gone, because CI installs every extra.
  • Uses the Dialect enum, and bans inline engines in tests with ruff TID251.
  • Replaces pg_session, which truncated every table in the shared public schema, with a fixture on scoped_test_schema. Each test gets its own schema, which is dropped afterwards, and raw SQL goes through the schema translation.
  • No test skips any more. A missing pg_dump or psql fails with a message that names the tool.
  • ci.yml adds the nodb job and moves the sqlite job to the v2 workflow.

Checklist

  • Applied exactly one label (breaking, feature, fix, dependencies, or chore)
  • Tests pass locally (uv run pytest -q)
  • Lint passes (uv run ruff check .)

@nicoloesch nicoloesch added the chore Maintenance, refactoring, or housekeeping. Excluded from changelog, no version bump. label Nov 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, refactoring, or housekeeping. Excluded from changelog, no version bump.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adopt the dialect-mark conventions

1 participant