mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #27032 -- Prevented setup_test_environment() from being called twice.
This commit is contained in:
committed by
Tim Graham
parent
a7863c78b7
commit
e7fb724cd2
@@ -20,6 +20,7 @@ from django.test import (
|
||||
from django.test.html import HTMLParseError, parse_html
|
||||
from django.test.utils import (
|
||||
CaptureQueriesContext, isolate_apps, override_settings,
|
||||
setup_test_environment,
|
||||
)
|
||||
from django.urls import NoReverseMatch, reverse
|
||||
from django.utils import six
|
||||
@@ -864,6 +865,13 @@ class SecondUrls:
|
||||
urlpatterns = [url(r'second/$', empty_response, name='second')]
|
||||
|
||||
|
||||
class SetupTestEnvironmentTests(SimpleTestCase):
|
||||
|
||||
def test_setup_test_environment_calling_more_than_once(self):
|
||||
with self.assertRaisesMessage(RuntimeError, "setup_test_environment() was already called"):
|
||||
setup_test_environment()
|
||||
|
||||
|
||||
class OverrideSettingsTests(SimpleTestCase):
|
||||
|
||||
# #21518 -- If neither override_settings nor a setting_changed receiver
|
||||
|
||||
Reference in New Issue
Block a user