diff options
| author | Andreas Pelme <andreas@pelme.se> | 2016-07-03 00:20:14 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-08-17 13:55:04 -0400 |
| commit | e76981b43325da60b8a7475661df6cbfa7fda37e (patch) | |
| tree | e8d521a2063177186b11ff330698905a2ba4e69e /tests | |
| parent | ff445f4c19a0fdf6696c99efefa38b1409b8709f (diff) | |
Fixed #26840 -- Added test.utils.setup/teardown_databases().
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_runner/tests.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py index 7fa54f0d87..c2ad07013c 100644 --- a/tests/test_runner/tests.py +++ b/tests/test_runner/tests.py @@ -14,8 +14,9 @@ from django.core.management import call_command from django.test import ( TestCase, TransactionTestCase, mock, skipUnlessDBFeature, testcases, ) -from django.test.runner import DiscoverRunner, dependency_ordered +from django.test.runner import DiscoverRunner from django.test.testcases import connections_support_transactions +from django.test.utils import dependency_ordered from .models import Person @@ -238,7 +239,7 @@ class DummyBackendTest(unittest.TestCase): Test that setup_databases() doesn't fail with dummy database backend. """ tested_connections = db.ConnectionHandler({}) - with mock.patch('django.test.runner.connections', new=tested_connections): + with mock.patch('django.test.utils.connections', new=tested_connections): runner_instance = DiscoverRunner(verbosity=0) old_config = runner_instance.setup_databases() runner_instance.teardown_databases(old_config) @@ -257,7 +258,7 @@ class AliasedDefaultTestSetupTest(unittest.TestCase): 'NAME': 'dummy' } }) - with mock.patch('django.test.runner.connections', new=tested_connections): + with mock.patch('django.test.utils.connections', new=tested_connections): runner_instance = DiscoverRunner(verbosity=0) old_config = runner_instance.setup_databases() runner_instance.teardown_databases(old_config) @@ -281,7 +282,7 @@ class SetupDatabasesTests(unittest.TestCase): }) with mock.patch('django.db.backends.dummy.base.DatabaseCreation') as mocked_db_creation: - with mock.patch('django.test.runner.connections', new=tested_connections): + with mock.patch('django.test.utils.connections', new=tested_connections): old_config = self.runner_instance.setup_databases() self.runner_instance.teardown_databases(old_config) mocked_db_creation.return_value.destroy_test_db.assert_called_once_with('dbname', 0, False) @@ -306,7 +307,7 @@ class SetupDatabasesTests(unittest.TestCase): }, }) with mock.patch('django.db.backends.dummy.base.DatabaseCreation') as mocked_db_creation: - with mock.patch('django.test.runner.connections', new=tested_connections): + with mock.patch('django.test.utils.connections', new=tested_connections): self.runner_instance.setup_databases() mocked_db_creation.return_value.create_test_db.assert_called_once_with( verbosity=0, autoclobber=False, serialize=True, keepdb=False @@ -320,7 +321,7 @@ class SetupDatabasesTests(unittest.TestCase): }, }) with mock.patch('django.db.backends.dummy.base.DatabaseCreation') as mocked_db_creation: - with mock.patch('django.test.runner.connections', new=tested_connections): + with mock.patch('django.test.utils.connections', new=tested_connections): self.runner_instance.setup_databases() mocked_db_creation.return_value.create_test_db.assert_called_once_with( verbosity=0, autoclobber=False, serialize=False, keepdb=False |
