williamacostalora opened a new pull request, #3688: URL: https://github.com/apache/iceberg-python/pull/3688
markdown<!-- Thanks for opening a pull request! --> Closes #2530 # Rationale for this change Python 3.13 introduced stricter resource leak detection that flags unclosed sqlite3 connections left open by SQLAlchemy connection pools after test teardown. PR #2863 added warning filters in `pyproject.toml` to suppress these warnings rather than fixing the root cause. This PR resolves the underlying issue by adding `catalog.close()` / `engine.dispose()` calls to all affected test fixtures and removes the sqlite `ResourceWarning` filter. Nine locations across `tests/catalog/test_sql.py` and `tests/conftest.py` created `SqlCatalog` instances without calling `catalog.close()` during teardown. The `close()` method (which calls `self.engine.dispose()`) already existed and was correctly implemented in `pyiceberg/catalog/sql.py` — it simply wasn't being invoked by the fixtures. **Note:** The two ray-related warning filters (`unclosed file`, `subprocess still running`) are left in place as ray is an optional dependency requiring a CI environment to reproduce and verify. Happy to address those in a follow-up PR. ## Are these changes tested? Yes. Removed the sqlite `ResourceWarning` filter from `pyproject.toml` and ran: uv run python -m pytest tests/catalog/test_sql.py -W error::ResourceWarning -v 13/13 tests pass with zero ResourceWarnings. Also added `test_catalog_fixture_closes_connections` to `TestSqlCatalogClose` as a regression test to prevent future regressions. ## Are there any user-facing changes? No — all changes are in test files and `pyproject.toml`. No public API changes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
