1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

Refs #36559 -- Ran template partial source tests in debug mode only.

Added a warning for accessing PartialTemplate.source when debugging is disabled.
Thanks Sarah Boyce for the idea.
This commit is contained in:
farhan
2025-09-02 14:59:30 -04:00
committed by Jacob Walls
parent f0c05a40d2
commit 3485599ef0
3 changed files with 153 additions and 65 deletions

View File

@@ -9,7 +9,7 @@ ROOT = os.path.dirname(os.path.abspath(__file__))
TEMPLATE_DIR = os.path.join(ROOT, "templates")
def setup(templates, *args, test_once=False):
def setup(templates, *args, test_once=False, debug_only=False):
"""
Runs test method multiple times in the following order:
@@ -54,11 +54,14 @@ def setup(templates, *args, test_once=False):
self.engine = Engine(
libraries=libraries,
loaders=loaders,
debug=debug_only,
)
func(self)
if test_once:
return
func(self)
if debug_only:
return
self.engine = Engine(
libraries=libraries,