-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
Summary
The inject_worker_schema_for_sql_tests autouse fixture in tests/conftest.py currently runs at function scope for SQL tests. In xdist runs, this repeats schema setup and URL patching work for every SQL test case.
Current behavior
- For each SQL test item, the fixture:
- reads/parses
SQLALCHEMY_DATABASE_URL - rewrites connection options for
search_path - monkeypatches environment/module constants
- attempts schema creation
- reads/parses
- This is functionally correct, but adds repeated overhead in parallel test runs.
Proposed change
Refactor SQL worker isolation into:
- a session-scoped worker fixture that creates and validates worker schema once and prepares worker-specific connection settings.
- lightweight function-scoped hooks only where per-test behavior is necessary.
Acceptance criteria
- SQL tests still pass in both serial and xdist modes.
- Worker schema is created once per worker process.
- Existing schema cleanup behavior remains correct.
- No regressions in SQL test isolation semantics.
Context
Follow-up from Copilot review discussion on PR #360.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels