summaryrefslogtreecommitdiff
path: root/tests/cache
diff options
context:
space:
mode:
authorMichael Manfre <mmanfre@gmail.com>2014-01-09 10:05:15 -0500
committerMichael Manfre <mmanfre@gmail.com>2014-02-02 12:47:21 -0500
commit3ffeb931869cc68a8e0916219702ee282afc6e9d (patch)
treef24020307dd5b529989329bfabfc95effcecffe8 /tests/cache
parent0837eacc4e1fa7916e48135e8ba43f54a7a64997 (diff)
Ensure cursors are closed when no longer needed.
This commit touchs various parts of the code base and test framework. Any found usage of opening a cursor for the sake of initializing a connection has been replaced with 'ensure_connection()'.
Diffstat (limited to 'tests/cache')
-rw-r--r--tests/cache/tests.py7
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)