mirror of https://github.com/django/django.git
Fixed test failure on Postgres that was added in r16510.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16512 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
90b6181657
commit
2b2bec0cc9
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
# Unit tests for cache framework
|
# Unit tests for cache framework
|
||||||
# Uses whatever cache backend is set in the test settings file.
|
# Uses whatever cache backend is set in the test settings file.
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
|
@ -775,23 +776,23 @@ class DBCacheRouter(object):
|
||||||
|
|
||||||
class CreateCacheTableForDBCacheTests(unittest.TestCase):
|
class CreateCacheTableForDBCacheTests(unittest.TestCase):
|
||||||
|
|
||||||
@override_settings(DEBUG=True)
|
|
||||||
def test_createcachetable_observes_database_router(self):
|
def test_createcachetable_observes_database_router(self):
|
||||||
old_routers = router.routers
|
with override_settings(DEBUG=True):
|
||||||
try:
|
old_routers = router.routers
|
||||||
router.routers = [DBCacheRouter()]
|
try:
|
||||||
# cache table should not be created on 'default'
|
router.routers = [DBCacheRouter()]
|
||||||
management.call_command('createcachetable', 'cache_table',
|
# cache table should not be created on 'default'
|
||||||
database='default',
|
management.call_command('createcachetable', 'cache_table',
|
||||||
verbosity=0, interactive=False)
|
database='default',
|
||||||
self.assertEqual(len(connections['default'].queries), 0)
|
verbosity=0, interactive=False)
|
||||||
# cache table should be created on 'other'
|
self.assertEqual(len(connections['default'].queries), 0)
|
||||||
management.call_command('createcachetable', 'cache_table',
|
# cache table should be created on 'other'
|
||||||
database='other',
|
management.call_command('createcachetable', 'cache_table',
|
||||||
verbosity=0, interactive=False)
|
database='other',
|
||||||
self.assertNotEqual(len(connections['other'].queries), 0)
|
verbosity=0, interactive=False)
|
||||||
finally:
|
self.assertNotEqual(len(connections['other'].queries), 0)
|
||||||
router.routers = old_routers
|
finally:
|
||||||
|
router.routers = old_routers
|
||||||
|
|
||||||
class LocMemCacheTests(unittest.TestCase, BaseCacheTests):
|
class LocMemCacheTests(unittest.TestCase, BaseCacheTests):
|
||||||
backend_name = 'django.core.cache.backends.locmem.LocMemCache'
|
backend_name = 'django.core.cache.backends.locmem.LocMemCache'
|
||||||
|
|
Loading…
Reference in New Issue