diff options
Diffstat (limited to 'tests/initial_sql_regress')
| -rw-r--r-- | tests/initial_sql_regress/tests.py | 6 |
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, |
