Loading django/test/runner.py +1 −2 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ from unittest import TestSuite, defaultTestLoader from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import DEFAULT_DB_ALIAS, connections from django.test import SimpleTestCase, TestCase from django.test.utils import setup_test_environment, teardown_test_environment from django.utils.datastructures import OrderedSet Loading Loading @@ -321,8 +322,6 @@ def partition_suite(suite, classes, bins, reverse=False): def setup_databases(verbosity, interactive, keepdb=False, debug_sql=False, **kwargs): from django.db import connections, DEFAULT_DB_ALIAS # First pass -- work out which databases actually need to be created, # and which ones are test mirrors or duplicate entries in DATABASES mirrored_aliases = {} Loading tests/test_runner/tests.py +5 −5 Original line number Diff line number Diff line Loading @@ -240,7 +240,7 @@ class DummyBackendTest(unittest.TestCase): Test that setup_databases() doesn't fail with dummy database backend. """ tested_connections = db.ConnectionHandler({}) with mock.patch('django.db.connections', new=tested_connections): with mock.patch('django.test.runner.connections', new=tested_connections): runner_instance = DiscoverRunner(verbosity=0) try: old_config = runner_instance.setup_databases() Loading @@ -263,7 +263,7 @@ class AliasedDefaultTestSetupTest(unittest.TestCase): 'NAME': 'dummy' } }) with mock.patch('django.db.connections', new=tested_connections): with mock.patch('django.test.runner.connections', new=tested_connections): runner_instance = DiscoverRunner(verbosity=0) try: old_config = runner_instance.setup_databases() Loading Loading @@ -291,7 +291,7 @@ class SetupDatabasesTests(unittest.TestCase): }) with mock.patch('django.db.backends.dummy.base.DatabaseCreation') as mocked_db_creation: with mock.patch('django.db.connections', new=tested_connections): with mock.patch('django.test.runner.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) Loading @@ -316,7 +316,7 @@ class SetupDatabasesTests(unittest.TestCase): }, }) with mock.patch('django.db.backends.dummy.base.DatabaseCreation') as mocked_db_creation: with mock.patch('django.db.connections', new=tested_connections): with mock.patch('django.test.runner.connections', new=tested_connections): self.runner_instance.setup_databases() mocked_db_creation.return_value.create_test_db.assert_called_once_with( 0, autoclobber=False, serialize=True, keepdb=False Loading @@ -330,7 +330,7 @@ class SetupDatabasesTests(unittest.TestCase): }, }) with mock.patch('django.db.backends.dummy.base.DatabaseCreation') as mocked_db_creation: with mock.patch('django.db.connections', new=tested_connections): with mock.patch('django.test.runner.connections', new=tested_connections): self.runner_instance.setup_databases() mocked_db_creation.return_value.create_test_db.assert_called_once_with( 0, autoclobber=False, serialize=False, keepdb=False Loading Loading
django/test/runner.py +1 −2 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ from unittest import TestSuite, defaultTestLoader from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import DEFAULT_DB_ALIAS, connections from django.test import SimpleTestCase, TestCase from django.test.utils import setup_test_environment, teardown_test_environment from django.utils.datastructures import OrderedSet Loading Loading @@ -321,8 +322,6 @@ def partition_suite(suite, classes, bins, reverse=False): def setup_databases(verbosity, interactive, keepdb=False, debug_sql=False, **kwargs): from django.db import connections, DEFAULT_DB_ALIAS # First pass -- work out which databases actually need to be created, # and which ones are test mirrors or duplicate entries in DATABASES mirrored_aliases = {} Loading
tests/test_runner/tests.py +5 −5 Original line number Diff line number Diff line Loading @@ -240,7 +240,7 @@ class DummyBackendTest(unittest.TestCase): Test that setup_databases() doesn't fail with dummy database backend. """ tested_connections = db.ConnectionHandler({}) with mock.patch('django.db.connections', new=tested_connections): with mock.patch('django.test.runner.connections', new=tested_connections): runner_instance = DiscoverRunner(verbosity=0) try: old_config = runner_instance.setup_databases() Loading @@ -263,7 +263,7 @@ class AliasedDefaultTestSetupTest(unittest.TestCase): 'NAME': 'dummy' } }) with mock.patch('django.db.connections', new=tested_connections): with mock.patch('django.test.runner.connections', new=tested_connections): runner_instance = DiscoverRunner(verbosity=0) try: old_config = runner_instance.setup_databases() Loading Loading @@ -291,7 +291,7 @@ class SetupDatabasesTests(unittest.TestCase): }) with mock.patch('django.db.backends.dummy.base.DatabaseCreation') as mocked_db_creation: with mock.patch('django.db.connections', new=tested_connections): with mock.patch('django.test.runner.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) Loading @@ -316,7 +316,7 @@ class SetupDatabasesTests(unittest.TestCase): }, }) with mock.patch('django.db.backends.dummy.base.DatabaseCreation') as mocked_db_creation: with mock.patch('django.db.connections', new=tested_connections): with mock.patch('django.test.runner.connections', new=tested_connections): self.runner_instance.setup_databases() mocked_db_creation.return_value.create_test_db.assert_called_once_with( 0, autoclobber=False, serialize=True, keepdb=False Loading @@ -330,7 +330,7 @@ class SetupDatabasesTests(unittest.TestCase): }, }) with mock.patch('django.db.backends.dummy.base.DatabaseCreation') as mocked_db_creation: with mock.patch('django.db.connections', new=tested_connections): with mock.patch('django.test.runner.connections', new=tested_connections): self.runner_instance.setup_databases() mocked_db_creation.return_value.create_test_db.assert_called_once_with( 0, autoclobber=False, serialize=False, keepdb=False Loading