diff --git a/optional_plugins/varianter_yaml_to_mux/tests/test_multiplex.py b/optional_plugins/varianter_yaml_to_mux/tests/test_multiplex.py index 57857d20ef580c1a20f092974e81d040d372e893..1562d1ca8850158a9757f9970564fce94cdc178c 100644 --- a/optional_plugins/varianter_yaml_to_mux/tests/test_multiplex.py +++ b/optional_plugins/varianter_yaml_to_mux/tests/test_multiplex.py @@ -83,8 +83,9 @@ class MultiplexTests(unittest.TestCase): expected_rc = exit_codes.AVOCADO_ALL_OK self.run_and_check(cmd_line, expected_rc, (4, 0)) # Also check whether jobdata contains correct parameter paths - variants = open(os.path.join(self.tmpdir, "latest", "jobdata", - "variants.json")).read() + with open(os.path.join(self.tmpdir, "latest", "jobdata", + "variants.json")) as variants_file: + variants = variants_file.read() self.assertIn('["/run/*"]', variants, "parameter paths stored in " "jobdata does not contains [\"/run/*\"]\n%s" % variants) @@ -96,8 +97,9 @@ class MultiplexTests(unittest.TestCase): % (AVOCADO, self.tmpdir)) self.run_and_check(cmd_line, exit_codes.AVOCADO_ALL_OK, (8, 0)) # Also check whether jobdata contains correct parameter paths - variants = open(os.path.join(self.tmpdir, "latest", "jobdata", - "variants.json")).read() + with open(os.path.join(self.tmpdir, "latest", "jobdata", + "variants.json")) as variants_file: + variants = variants_file.read() exp = '["/foo/*", "/bar/*", "/baz/*"]' self.assertIn(exp, variants, "parameter paths stored in jobdata " "does not contains %s\n%s" % (exp, variants))