diff options
Diffstat (limited to 'tests/cache')
| -rw-r--r-- | tests/cache/tests.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py index 94790ed740..bc0f705375 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -896,10 +896,9 @@ class DBCacheTests(BaseCacheTests, TransactionTestCase): management.call_command('createcachetable', verbosity=0, interactive=False) def drop_table(self): - cursor = connection.cursor() - table_name = connection.ops.quote_name('test cache table') - cursor.execute('DROP TABLE %s' % table_name) - cursor.close() + with connection.cursor() as cursor: + table_name = connection.ops.quote_name('test cache table') + cursor.execute('DROP TABLE %s' % table_name) def test_zero_cull(self): self._perform_cull_test(caches['zero_cull'], 50, 18) |
