From 2c6dc4cddf517cd2c9cd6db9eabddd64377e0aa9 Mon Sep 17 00:00:00 2001 From: samm81 Date: Mon, 25 Aug 2025 16:06:28 +0800 Subject: [PATCH] updates `SqliteStatus` to properly close connections otherwise, when trying to run `pytest` in a `python3.13` environment results in a bunch of ``` tests/unit/sync/test_sync.py::test_partial_sync_ignore /home/user/.asdf/installs/python/3.13.1/lib/python3.13/asyncio/base_events.py:650: ResourceWarning: unclosed database in sys.set_asyncgen_hooks( Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. ``` --- vdirsyncer/sync/status.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vdirsyncer/sync/status.py b/vdirsyncer/sync/status.py index 1f3f910..b5f5246 100644 --- a/vdirsyncer/sync/status.py +++ b/vdirsyncer/sync/status.py @@ -169,6 +169,14 @@ class SqliteStatus(_StatusBase): ); """ ) + def close(self): + if self._c: + self._c.close() + self._c = None + + def __del__(self): + self.close() + def _is_latest_version(self): try: return bool(