mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #31233 -- Closed database connections and cursors after use.
This commit is contained in:
committed by
Mariusz Felisiak
parent
f48f671223
commit
3259983f56
@@ -226,7 +226,8 @@ class AssertNumQueriesUponConnectionTests(TransactionTestCase):
|
||||
if is_opening_connection:
|
||||
# Avoid infinite recursion. Creating a cursor calls
|
||||
# ensure_connection() which is currently mocked by this method.
|
||||
connection.cursor().execute('SELECT 1' + connection.features.bare_select_suffix)
|
||||
with connection.cursor() as cursor:
|
||||
cursor.execute('SELECT 1' + connection.features.bare_select_suffix)
|
||||
|
||||
ensure_connection = 'django.db.backends.base.base.BaseDatabaseWrapper.ensure_connection'
|
||||
with mock.patch(ensure_connection, side_effect=make_configuration_query):
|
||||
|
||||
Reference in New Issue
Block a user