diff options
| -rw-r--r-- | tests/admin_views/test_multidb.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/admin_views/test_multidb.py b/tests/admin_views/test_multidb.py index 0f18aeb315..870d434b02 100644 --- a/tests/admin_views/test_multidb.py +++ b/tests/admin_views/test_multidb.py @@ -3,6 +3,7 @@ from unittest import mock from django.contrib import admin from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType +from django.contrib.sites.models import Site from django.http import HttpResponse from django.test import TestCase, override_settings from django.urls import path, reverse @@ -193,6 +194,11 @@ class ViewOnSiteRouter: class ViewOnSiteTests(TestCase): databases = {"default", "other"} + def tearDown(self): + # Reads via ViewOnSiteRouter may prime the global SITE_CACHE using the + # "other" db, which is problematic for other tests that do not use it. + Site.objects.clear_cache() + def test_contenttype_in_separate_db(self): ContentType.objects.using("other").all().delete() book = Book.objects.using("other").create(name="other book") |
