summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2014-03-13 21:07:27 +0100
committerJames Cammarata <jimi@sngx.net>2014-03-13 22:24:29 +0100
commit8df29e7c8b996c6b4771701338975fe578d19ea2 (patch)
tree0f42f3c6b0a82a9b69ef8bfa61197ad9dfeb1bb5 /test
parentBe sure to return to the old directory if cwd is set in run_command (diff)
downloadansible-8df29e7c8b996c6b4771701338975fe578d19ea2.tar.xz
ansible-8df29e7c8b996c6b4771701338975fe578d19ea2.zip
Cleaning up some exception blocks in TestModuleUtilsBasic
Diffstat (limited to 'test')
-rw-r--r--test/units/TestModuleUtilsBasic.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/units/TestModuleUtilsBasic.py b/test/units/TestModuleUtilsBasic.py
index 167ee370fd..547de0f792 100644
--- a/test/units/TestModuleUtilsBasic.py
+++ b/test/units/TestModuleUtilsBasic.py
@@ -110,9 +110,9 @@ class TestModuleUtilsBasic(unittest.TestCase):
md5sum = utils_md5(tmp_path)
self.assertEqual(md5sum, '5ceaa7ed396ccb8e959c02753cb4bd18')
except:
- self.cleanup_temp_file(tmp_fd, tmp_path)
raise
- self.cleanup_temp_file(tmp_fd, tmp_path)
+ finally:
+ self.cleanup_temp_file(tmp_fd, tmp_path)
# test run_command with a double shell redirect out (append) (with both use_unsafe_shell=True|False)
def test_run_command_string_unsafe_with_double_redirect_out(self):
@@ -124,9 +124,9 @@ class TestModuleUtilsBasic(unittest.TestCase):
md5sum = utils_md5(tmp_path)
self.assertEqual(md5sum, '5ceaa7ed396ccb8e959c02753cb4bd18')
except:
- self.cleanup_temp_file(tmp_fd, tmp_path)
raise
- self.cleanup_temp_file(tmp_fd, tmp_path)
+ finally:
+ self.cleanup_temp_file(tmp_fd, tmp_path)
# test run_command with data
def test_run_command_string_with_data(self):
@@ -149,8 +149,8 @@ class TestModuleUtilsBasic(unittest.TestCase):
self.assertTrue(os.path.exists(tmp_path))
self.assertEqual(out.strip(), tmp_path)
except:
- self.cleanup_temp_dir(tmp_path)
raise
- self.cleanup_temp_dir(tmp_path)
+ finally:
+ self.cleanup_temp_dir(tmp_path)