summaryrefslogtreecommitdiff
path: root/tests/initial_sql_regress
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-02-02 10:37:27 -0800
committerAymeric Augustin <aymeric.augustin@m4x.org>2014-02-02 10:37:27 -0800
commit54bfa4caab11d364eb208ba6639836fa22d69a04 (patch)
treef24020307dd5b529989329bfabfc95effcecffe8 /tests/initial_sql_regress
parentab2f21080d8b3112c1ba9a0bf923eae733be4242 (diff)
parent3ffeb931869cc68a8e0916219702ee282afc6e9d (diff)
Merge pull request #2154 from manfre/close-cursors
Fixed #21751 -- Explicitly closed cursors.
Diffstat (limited to 'tests/initial_sql_regress')
-rw-r--r--tests/initial_sql_regress/tests.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/initial_sql_regress/tests.py b/tests/initial_sql_regress/tests.py
index e725f4b102..428d993667 100644
--- a/tests/initial_sql_regress/tests.py
+++ b/tests/initial_sql_regress/tests.py
@@ -28,9 +28,9 @@ class InitialSQLTests(TestCase):
connection = connections[DEFAULT_DB_ALIAS]
custom_sql = custom_sql_for_model(Simple, no_style(), connection)
self.assertEqual(len(custom_sql), 9)
- cursor = connection.cursor()
- for sql in custom_sql:
- cursor.execute(sql)
+ with connection.cursor() as cursor:
+ for sql in custom_sql:
+ cursor.execute(sql)
self.assertEqual(Simple.objects.count(), 9)
self.assertEqual(
Simple.objects.get(name__contains='placeholders').name,