diff options
| author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2016-08-08 02:38:10 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-08-08 10:40:29 -0400 |
| commit | e7fb724cd2928802fbefa3b5491640fab51e898a (patch) | |
| tree | 27613017be54bd10fce376a84c97ed6478929c62 /django | |
| parent | a7863c78b7f3619a8d3d27e67c7284a349058c08 (diff) | |
Fixed #27032 -- Prevented setup_test_environment() from being called twice.
Diffstat (limited to 'django')
| -rw-r--r-- | django/test/utils.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/django/test/utils.py b/django/test/utils.py index 3ae68b8a2f..57ae46fe1c 100644 --- a/django/test/utils.py +++ b/django/test/utils.py @@ -99,6 +99,13 @@ def setup_test_environment(): Perform global pre-test setup, such as installing the instrumented template renderer and setting the email backend to the locmem email backend. """ + if hasattr(Template, '_original_render'): + # Executing this function twice would overwrite the saved values. + raise RuntimeError( + "setup_test_environment() was already called and can't be called " + "again without first calling teardown_test_environment()." + ) + Template._original_render = Template._render Template._render = instrumented_test_render |
