diff options
Diffstat (limited to 'functest/opnfv_tests/vnf/router/test_controller/function_test_exec.py')
-rw-r--r-- | functest/opnfv_tests/vnf/router/test_controller/function_test_exec.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/functest/opnfv_tests/vnf/router/test_controller/function_test_exec.py b/functest/opnfv_tests/vnf/router/test_controller/function_test_exec.py index 0a56913b7..7c532d9a3 100644 --- a/functest/opnfv_tests/vnf/router/test_controller/function_test_exec.py +++ b/functest/opnfv_tests/vnf/router/test_controller/function_test_exec.py @@ -32,13 +32,12 @@ class FunctionTestExec(): credentials = util_info["credentials"] self.vnf_ctrl = VnfController(util_info) - test_cmd_map_file = open( - os.path.join( - self.util.vnf_data_dir, self.util.command_template_dir, - self.util.test_cmd_map_yaml_file), - 'r') - self.test_cmd_map_yaml = yaml.safe_load(test_cmd_map_file) - test_cmd_map_file.close() + with open( + os.path.join( + self.util.vnf_data_dir, self.util.command_template_dir, + self.util.test_cmd_map_yaml_file), + 'r') as test_cmd_map_file: + self.test_cmd_map_yaml = yaml.safe_load(test_cmd_map_file) self.util.set_credentials(credentials["cloud"]) |