mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
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()'.
This commit is contained in:
7
tests/cache/tests.py
vendored
7
tests/cache/tests.py
vendored
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user