mirror of https://github.com/django/django.git
Made test_once a keyword argument in template_tests.utils.setup().
Replaces the kwargs.get(...) pattern. Helps avoid typos by providing a better error message in case of misuse.
This commit is contained in:
parent
4484bc1b2f
commit
81d69568a6
|
@ -9,7 +9,7 @@ ROOT = os.path.dirname(os.path.abspath(__file__))
|
||||||
TEMPLATE_DIR = os.path.join(ROOT, 'templates')
|
TEMPLATE_DIR = os.path.join(ROOT, 'templates')
|
||||||
|
|
||||||
|
|
||||||
def setup(templates, *args, **kwargs):
|
def setup(templates, *args, test_once=False):
|
||||||
"""
|
"""
|
||||||
Runs test method multiple times in the following order:
|
Runs test method multiple times in the following order:
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@ def setup(templates, *args, **kwargs):
|
||||||
False True INVALID
|
False True INVALID
|
||||||
True False
|
True False
|
||||||
True True
|
True True
|
||||||
|
|
||||||
|
Use test_once=True to test deprecation warnings since the message won't be
|
||||||
|
displayed multiple times.
|
||||||
"""
|
"""
|
||||||
# when testing deprecation warnings, it's useful to run just one test since
|
|
||||||
# the message won't be displayed multiple times
|
|
||||||
test_once = kwargs.get('test_once', False)
|
|
||||||
|
|
||||||
for arg in args:
|
for arg in args:
|
||||||
templates.update(arg)
|
templates.update(arg)
|
||||||
|
|
Loading…
Reference in New Issue