mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
Fixed ResourceWarning from unclosed SQLite connection in test_utils on Python 3.13+.
On SQLite, close() doesn't explicitly close in-memory connections. Follow up to921670c694anddd45d5223b.
This commit is contained in:
@@ -2158,7 +2158,8 @@ class AllowedDatabaseQueriesTests(SimpleTestCase):
|
|||||||
# closed on teardown).
|
# closed on teardown).
|
||||||
for conn in connections_dict.values():
|
for conn in connections_dict.values():
|
||||||
if conn is not connection and conn.allow_thread_sharing:
|
if conn is not connection and conn.allow_thread_sharing:
|
||||||
conn.close()
|
conn.validate_thread_sharing()
|
||||||
|
conn._close()
|
||||||
conn.dec_thread_sharing()
|
conn.dec_thread_sharing()
|
||||||
|
|
||||||
def test_allowed_database_copy_queries(self):
|
def test_allowed_database_copy_queries(self):
|
||||||
@@ -2169,7 +2170,8 @@ class AllowedDatabaseQueriesTests(SimpleTestCase):
|
|||||||
cursor.execute(sql)
|
cursor.execute(sql)
|
||||||
self.assertEqual(cursor.fetchone()[0], 1)
|
self.assertEqual(cursor.fetchone()[0], 1)
|
||||||
finally:
|
finally:
|
||||||
new_connection.close()
|
new_connection.validate_thread_sharing()
|
||||||
|
new_connection._close()
|
||||||
|
|
||||||
|
|
||||||
class DatabaseAliasTests(SimpleTestCase):
|
class DatabaseAliasTests(SimpleTestCase):
|
||||||
|
|||||||
Reference in New Issue
Block a user