diff options
| author | Jannis Leidel <jannis@leidel.info> | 2011-07-05 09:40:29 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2011-07-05 09:40:29 +0000 |
| commit | 2b2bec0cc96943c42f2f51cdc3331df4f2e33951 (patch) | |
| tree | 7b6848ba0004a6400ac0fbc3105530d9c7ba31bd | |
| parent | 90b6181657eafe1601ee90e4af26cd32cb301fb4 (diff) | |
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
| -rw-r--r-- | tests/regressiontests/cache/tests.py | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/tests/regressiontests/cache/tests.py b/tests/regressiontests/cache/tests.py index 6f1aa0d24f..278b6b69da 100644 --- a/tests/regressiontests/cache/tests.py +++ b/tests/regressiontests/cache/tests.py @@ -2,6 +2,7 @@ # Unit tests for cache framework # Uses whatever cache backend is set in the test settings file. +from __future__ import with_statement import hashlib import os @@ -775,23 +776,23 @@ class DBCacheRouter(object): class CreateCacheTableForDBCacheTests(unittest.TestCase): - @override_settings(DEBUG=True) def test_createcachetable_observes_database_router(self): - old_routers = router.routers - try: - router.routers = [DBCacheRouter()] - # cache table should not be created on 'default' - management.call_command('createcachetable', 'cache_table', - database='default', - verbosity=0, interactive=False) - self.assertEqual(len(connections['default'].queries), 0) - # cache table should be created on 'other' - management.call_command('createcachetable', 'cache_table', - database='other', - verbosity=0, interactive=False) - self.assertNotEqual(len(connections['other'].queries), 0) - finally: - router.routers = old_routers + with override_settings(DEBUG=True): + old_routers = router.routers + try: + router.routers = [DBCacheRouter()] + # cache table should not be created on 'default' + management.call_command('createcachetable', 'cache_table', + database='default', + verbosity=0, interactive=False) + self.assertEqual(len(connections['default'].queries), 0) + # cache table should be created on 'other' + management.call_command('createcachetable', 'cache_table', + database='other', + verbosity=0, interactive=False) + self.assertNotEqual(len(connections['other'].queries), 0) + finally: + router.routers = old_routers class LocMemCacheTests(unittest.TestCase, BaseCacheTests): backend_name = 'django.core.cache.backends.locmem.LocMemCache' |
