summaryrefslogtreecommitdiff
path: root/tests/commands_sql
diff options
context:
space:
mode:
authorwrwrwr <git@wr.waw.pl>2014-11-29 18:09:40 +0100
committerTim Graham <timograham@gmail.com>2014-12-01 11:34:15 -0500
commit9136ceb6fb8225625631671147ff70c1fcfbbcdc (patch)
treefe846d89151c87b7474fbe2ef8cdedcde578dba4 /tests/commands_sql
parente6f19ec3223ba7c398aea515c5e0f8b93e6f4359 (diff)
Replaced router.routers usage with override_settings(DATABASE_ROUTERS); refs #23933.
Diffstat (limited to 'tests/commands_sql')
-rw-r--r--tests/commands_sql/tests.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/tests/commands_sql/tests.py b/tests/commands_sql/tests.py
index e9499d6b05..e381c031a5 100644
--- a/tests/commands_sql/tests.py
+++ b/tests/commands_sql/tests.py
@@ -7,8 +7,8 @@ from django.apps import apps
from django.core.management.color import no_style
from django.core.management.sql import (sql_create, sql_delete, sql_indexes,
sql_destroy_indexes, sql_all)
-from django.db import connections, DEFAULT_DB_ALIAS, router
-from django.test import TestCase
+from django.db import connections, DEFAULT_DB_ALIAS
+from django.test import TestCase, override_settings
from django.utils import six
# See also initial_sql_regress for 'custom_sql_for_model' tests
@@ -91,13 +91,8 @@ class TestRouter(object):
return False
+@override_settings(DATABASE_ROUTERS=[TestRouter()])
class SQLCommandsRouterTestCase(TestCase):
- def setUp(self):
- self._old_routers = router.routers
- router.routers = [TestRouter()]
-
- def tearDown(self):
- router.routers = self._old_routers
def test_router_honored(self):
app_config = apps.get_app_config('commands_sql')