diff options
author | Matthijs Kooijman <matthijs@stdin.nl> | 2019-12-20 20:49:56 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-01-20 14:39:02 +0100 |
commit | 2a2ea4ee18fdcf2c95bf6435bc63b74623e3085b (patch) | |
tree | 32c7c87c71535a8493c07e2073f1bfcd1aa7e24d /tests/multiple_database | |
parent | 26be703fe679a58bbdccf37a276a9c430ccb29f7 (diff) | |
download | django-2a2ea4ee18fdcf2c95bf6435bc63b74623e3085b.tar.gz |
Refs #31117 -- Made various tests properly handle unexpected databases aliases.
- Used selected "databases" instead of django.db.connections.
- Made routers in tests.migrations skip migrations on unexpected
databases.
- Added DiscoverRunnerGetDatabasesTests.assertSkippedDatabases() hook
which properly asserts messages about skipped databases.
Diffstat (limited to 'tests/multiple_database')
-rw-r--r-- | tests/multiple_database/tests.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/multiple_database/tests.py b/tests/multiple_database/tests.py index e39967ce78..2a6a725472 100644 --- a/tests/multiple_database/tests.py +++ b/tests/multiple_database/tests.py @@ -7,7 +7,7 @@ from unittest.mock import Mock from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.core import management -from django.db import DEFAULT_DB_ALIAS, connections, router, transaction +from django.db import DEFAULT_DB_ALIAS, router, transaction from django.db.models import signals from django.db.utils import ConnectionRouter from django.test import SimpleTestCase, TestCase, override_settings @@ -1632,7 +1632,7 @@ class PickleQuerySetTestCase(TestCase): databases = {'default', 'other'} def test_pickling(self): - for db in connections: + for db in self.databases: Book.objects.using(db).create(title='Dive into Python', published=datetime.date(2009, 5, 4)) qs = Book.objects.all() self.assertEqual(qs.db, pickle.loads(pickle.dumps(qs)).db) |