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

optional_plugins.varianter_yaml_to_mux: Close opened files

Explicitly close the files we are using.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 47c4e093
...@@ -83,8 +83,9 @@ class MultiplexTests(unittest.TestCase): ...@@ -83,8 +83,9 @@ class MultiplexTests(unittest.TestCase):
expected_rc = exit_codes.AVOCADO_ALL_OK expected_rc = exit_codes.AVOCADO_ALL_OK
self.run_and_check(cmd_line, expected_rc, (4, 0)) self.run_and_check(cmd_line, expected_rc, (4, 0))
# Also check whether jobdata contains correct parameter paths # Also check whether jobdata contains correct parameter paths
variants = open(os.path.join(self.tmpdir, "latest", "jobdata", with open(os.path.join(self.tmpdir, "latest", "jobdata",
"variants.json")).read() "variants.json")) as variants_file:
variants = variants_file.read()
self.assertIn('["/run/*"]', variants, "parameter paths stored in " self.assertIn('["/run/*"]', variants, "parameter paths stored in "
"jobdata does not contains [\"/run/*\"]\n%s" % variants) "jobdata does not contains [\"/run/*\"]\n%s" % variants)
...@@ -96,8 +97,9 @@ class MultiplexTests(unittest.TestCase): ...@@ -96,8 +97,9 @@ class MultiplexTests(unittest.TestCase):
% (AVOCADO, self.tmpdir)) % (AVOCADO, self.tmpdir))
self.run_and_check(cmd_line, exit_codes.AVOCADO_ALL_OK, (8, 0)) self.run_and_check(cmd_line, exit_codes.AVOCADO_ALL_OK, (8, 0))
# Also check whether jobdata contains correct parameter paths # Also check whether jobdata contains correct parameter paths
variants = open(os.path.join(self.tmpdir, "latest", "jobdata", with open(os.path.join(self.tmpdir, "latest", "jobdata",
"variants.json")).read() "variants.json")) as variants_file:
variants = variants_file.read()
exp = '["/foo/*", "/bar/*", "/baz/*"]' exp = '["/foo/*", "/bar/*", "/baz/*"]'
self.assertIn(exp, variants, "parameter paths stored in jobdata " self.assertIn(exp, variants, "parameter paths stored in jobdata "
"does not contains %s\n%s" % (exp, variants)) "does not contains %s\n%s" % (exp, variants))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册