diff --git a/django/contrib/flatpages/tests/test_sitemaps.py b/django/contrib/flatpages/tests/test_sitemaps.py index 3b8e57d174..dcfbef4e29 100644 --- a/django/contrib/flatpages/tests/test_sitemaps.py +++ b/django/contrib/flatpages/tests/test_sitemaps.py @@ -1,6 +1,7 @@ from __future__ import unicode_literals from django.apps import apps +from django.contrib.sites.models import Site from django.test import TestCase from django.test.utils import modify_settings, override_settings @@ -12,6 +13,13 @@ from django.test.utils import modify_settings, override_settings @modify_settings(INSTALLED_APPS={'append': ['django.contrib.sitemaps']},) class FlatpagesSitemapTests(TestCase): + @classmethod + def setUpClass(cls): + super(FlatpagesSitemapTests, cls).setUpClass() + # This cleanup is necessary because contrib.sites cache + # makes tests interfere with each other, see #11505 + Site.objects.clear_cache() + @classmethod def setUpTestData(cls): Site = apps.get_model('sites.Site')