mirror of
https://github.com/beetbox/beets.git
synced 2026-01-30 12:02:41 +01:00
tests: more explicit sqlite3 connection close()ing
This commit is contained in:
parent
0d1fa172de
commit
6f0d305489
1 changed files with 8 additions and 2 deletions
|
|
@ -975,7 +975,11 @@ class Database:
|
|||
# bytestring paths here on Python 3, so we need to
|
||||
# provide a `str` using `py3_path`.
|
||||
conn = sqlite3.connect(
|
||||
py3_path(self.path), timeout=self.timeout
|
||||
py3_path(self.path),
|
||||
timeout=self.timeout,
|
||||
# We have our own same-thread checks in _connection(), but need to
|
||||
# call conn.close() in _close()
|
||||
check_same_thread=False,
|
||||
)
|
||||
self.add_functions(conn)
|
||||
|
||||
|
|
@ -1005,7 +1009,9 @@ class Database:
|
|||
unusable; new connections can still be opened on demand.
|
||||
"""
|
||||
with self._shared_map_lock:
|
||||
self._connections.clear()
|
||||
while self._connections:
|
||||
_thread_id, conn = self._connections.popitem()
|
||||
conn.close()
|
||||
|
||||
@contextlib.contextmanager
|
||||
def _tx_stack(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue