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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user