Conversation
Add pytest fixture support for GizmoSQL, a high-performance SQL server built on Apache Arrow Flight SQL with DuckDB/SQLite backends. - Add GizmoSQLService with username, password, and uri property - Add gizmosql_service and gizmosql_connection fixtures - Support TLS connections with self-signed certificate handling - Add server-only xdist isolation (DuckDB doesn't support multiple DBs) - Add documentation with usage examples - Add comprehensive tests
- Add pytest_plugins = ["pytest_databases"] to all database modules for fixture discovery in pytest 9.0+ subprocess test environments - Move docker compose utilities from __init__.py to _compose.py to fix RUF067 (non-empty init module) lint errors - Fix B901 (return in generator) in _service.py pytest_sessionfinish hook
Pytest 9.0+ enforces strict 1-to-1 mapping between plugin objects and registered names. Using pytest_plugins declarations in test templates conflicts with the entry point registration. Changes: - Remove pytest_plugins declarations from source database modules - Simplify test templates to only declare the database-specific plugin - Add -p pytest_databases CLI arg to all runpytest() calls to force early plugin registration via the entry point This ensures docker_service fixture is available before database modules load, mimicking real-world installed usage.
When pytest_plugins declares a submodule (e.g., pytest_databases.docker.bigquery), Python imports the parent package first. With an empty __init__.py, the fixtures from _service.py weren't available even with -p pytest_databases because pytest treats the already-imported package as the plugin module. This fix makes __init__.py import and re-export the fixtures so they are available regardless of import order.
…n database plugin tests.
- Change xdist_gizmosql_isolation_level default from "server" to "database" to prevent container double-cleanup errors in pytester tests - Use runpytest_subprocess for azure_blob tests to avoid PyO3/cryptography "may only be initialized once per interpreter process" error
The pytest_sessionfinish hook is registered via the entry point (pytest_databases._service). Re-exporting it from __init__.py could cause duplicate hook registration or cleanup issues.
…n database plugin tests. Use subprocess mode for all pytester tests to isolate native extensions (grpc, pymssql, cryptography, etc.) from the main pytest process. This prevents segfaults during Python interpreter shutdown caused by native extension cleanup conflicts.
All pytester tests now use runpytest_subprocess() instead of runpytest(): 1. Tests using pytest-xdist (-n flag) need subprocess mode 2. Native extensions (grpc, cryptography, pymssql) can cause segfaults during Python interpreter shutdown if loaded in main process 3. pytest 9.0+ plugin discovery works more reliably in subprocess mode Also reverts unnecessary refactoring of docker/__init__.py and __init__.py
…orts and comments in tests, and add VS Code launch and settings configurations.
Member
|
Should we test against different pytest versions as well? Might blow up our test suite a bit but.. If there's breaking changes, we should test compatibility somehow, otherwise stuff might break. |
Member
Author
yeah - if we can improve the testing, i think we should. I'll look at adding in multi-versions of pytest in the CI hook. Opened associated issue here |
provinzkraut
approved these changes
Jan 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GizmoSQLServicedataclass with username, password, and uri property for TLS connectionsgizmosql_serviceandgizmosql_connectionfixtures