summaryrefslogtreecommitdiff
path: root/tests/servers
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-08-23 09:09:23 +0200
committerGitHub <noreply@github.com>2023-08-23 09:09:23 +0200
commitdd45d5223b3c5640baefcb591782bbcff873b6bf (patch)
treecc5f61b2c82e6a1f0c605e91f788dc7b39f4806f /tests/servers
parenta9e0f3d3014461c2199123721899162c0876959d (diff)
Fixed ResourceWarning from unclosed SQLite connection on Python 3.13+.
- backends.sqlite.tests.ThreadSharing.test_database_sharing_in_threads - backends.tests.ThreadTests.test_default_connection_thread_local: on SQLite, close() doesn't explicitly close in-memory connections. - servers.tests.LiveServerInMemoryDatabaseLockTest - test_runner.tests.SQLiteInMemoryTestDbs.test_transaction_support Check out https://github.com/python/cpython/pull/108015.
Diffstat (limited to 'tests/servers')
-rw-r--r--tests/servers/tests.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/servers/tests.py b/tests/servers/tests.py
index 4dece98ce9..ea49c11534 100644
--- a/tests/servers/tests.py
+++ b/tests/servers/tests.py
@@ -115,6 +115,7 @@ class LiveServerInMemoryDatabaseLockTest(LiveServerBase):
connection.
"""
conn = self.server_thread.connections_override[DEFAULT_DB_ALIAS]
+ source_connection = conn.connection
# Open a connection to the database.
conn.connect()
# Create a transaction to lock the database.
@@ -128,6 +129,7 @@ class LiveServerInMemoryDatabaseLockTest(LiveServerBase):
finally:
# Release the transaction.
cursor.execute("ROLLBACK")
+ source_connection.close()
class FailingLiveServerThread(LiveServerThread):