提交 d74158ec 编写于 作者: L Lukáš Doktor

avocado.core.runner: Force methodName on replay_map substitution

The "replay_map" allows to substitute the test class with custom class.
The problem is, that the "methodName" defined in "test_params" might not
exist in this class.

We have two choices, either leave it up to the user, to substitute with
a compatible class (eg. by creating the "methodName" in "__init__"
before calling the super.__init__), or we can require them to always use
given "methodName". This patch uses the second approach as it seems less
magical to me.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 9e65f699
......@@ -392,6 +392,7 @@ class TestRunner(object):
else:
if (replay_map is not None and
replay_map[index] is not None):
test_parameters["methodName"] = "test"
test_factory = (replay_map[index], test_parameters)
break_loop = not self.run_test(test_factory, queue, failures,
......
......@@ -367,6 +367,13 @@ class RunnerHumanOutputTest(unittest.TestCase):
self.assertEqual(os.path.basename(test_dirs[0]),
'_bin_echo -ne foo\\\\n\\\'\\"\\\\nbar_baz')
def test_replay_skip_skipped(self):
result = process.run("./scripts/avocado run skiponsetup --json -")
result = json.loads(result.stdout)
jobid = result["job_id"]
process.run(str("./scripts/avocado run --replay %s "
"--replay-test-status PASS" % jobid))
def tearDown(self):
shutil.rmtree(self.tmpdir)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册