summaryrefslogtreecommitdiff
path: root/tests/cache
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-03-22 11:02:00 +0100
committerTim Graham <timograham@gmail.com>2014-07-24 18:48:05 -0400
commit2a97db33a79c0be179b5bc35860400287f1ae26a (patch)
tree7ae7dce309dd29587dd209b1af53245da181a193 /tests/cache
parent5ca82ff71baa9d749c98ef68e8f8814cf7afcf5d (diff)
[1.7.x] Avoided transactional DDL on castrated databases.
Fixed a test failure that appeared after 753a22a6, although the bug existed before that commit. Refs #22308 and #23089. Backport of 0757e0f30d from master
Diffstat (limited to 'tests/cache')
-rw-r--r--tests/cache/tests.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index 21a92c3b46..a0b6698c79 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -19,7 +19,7 @@ from django.core import management
from django.core.cache import (cache, caches, CacheKeyWarning,
InvalidCacheBackendError, DEFAULT_CACHE_ALIAS)
from django.core.context_processors import csrf
-from django.db import connection, router, transaction
+from django.db import connection, connections, router, transaction
from django.core.cache.utils import make_template_fragment_key
from django.http import HttpResponse, StreamingHttpResponse
from django.middleware.cache import (FetchFromCacheMiddleware,
@@ -989,11 +989,12 @@ class CreateCacheTableForDBCacheTests(TestCase):
# cache table should be created on 'other'
# Queries:
# 1: check table doesn't already exist
- # 2: create savepoint
+ # 2: create savepoint (if transactional DDL is supported)
# 3: create the table
# 4: create the index
- # 5: release savepoint
- with self.assertNumQueries(5, using='other'):
+ # 5: release savepoint (if transactional DDL is supported)
+ num = 5 if connections['other'].features.can_rollback_ddl else 3
+ with self.assertNumQueries(num, using='other'):
management.call_command('createcachetable',
database='other',
verbosity=0, interactive=False)