提交 559373d7 编写于 作者: C Cleber Rosa

avocado/core/runner.py: properly define the execution order

Allowing 'None' to be used as a possible value in the list of valid
execution order modes is a way to deal with a default (implicit)
mode.

Let's make this default mode explicit and documented.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 2bfcc2c2
......@@ -274,6 +274,10 @@ class TestRunner(object):
"""
DEFAULT_TIMEOUT = 86400
#: Mode in which this runner should iterate through tests and variants.
#: The allowed values are "variants-per-test" or "tests-per-variant"
DEFAULT_EXECUTION_ORDER = "variants-per-test"
def __init__(self, job, result):
"""
Creates an instance of TestRunner class.
......@@ -545,7 +549,7 @@ class TestRunner(object):
:param execution_order: way of iterating through tests/variants
:return: generator yielding tuple(test_factory, variant)
"""
if execution_order in ("variants-per-test", None):
if execution_order == "variants-per-test":
return (self._template_to_factory(template, variant)
for template in test_suite
for variant in variants.itertests())
......@@ -568,7 +572,8 @@ class TestRunner(object):
:param replay_map: optional list to override test class based on test
index.
:param execution_order: Mode in which we should iterate through tests
resp. variants.
and variants. If not provided, will default to
:attr:`DEFAULT_EXECUTION_ORDER`.
:return: a set with types of test failures.
"""
summary = set()
......@@ -595,6 +600,8 @@ class TestRunner(object):
for test_template in test_suite:
test_template[1]["base_logdir"] = self.job.logdir
test_template[1]["job"] = self.job
if execution_order is None:
execution_order = self.DEFAULT_EXECUTION_ORDER
for test_factory, variant in self._iter_suite(test_suite, variants,
execution_order):
index += 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册