summaryrefslogtreecommitdiffstats
path: root/testsuite/Testsrc/Testlib/TestOptions/__init__.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2014-10-22 12:53:54 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2014-11-10 17:35:43 -0600
commitb50d7b239f5b6530873df25a80dde484f955581c (patch)
tree94608f3d954da7f8a9d1f3aabecee13bfc1c3797 /testsuite/Testsrc/Testlib/TestOptions/__init__.py
parent4ec92cb9e7d1eb2f90d36e5255ee8814ca0a8513 (diff)
downloadbcfg2-b50d7b239f5b6530873df25a80dde484f955581c.tar.gz
bcfg2-b50d7b239f5b6530873df25a80dde484f955581c.tar.bz2
bcfg2-b50d7b239f5b6530873df25a80dde484f955581c.zip
testsuite: unlink temporary files
This cleans up the temporary config files created by the option parsing unit tests. Courtesy Alexander Sulfrian.
Diffstat (limited to 'testsuite/Testsrc/Testlib/TestOptions/__init__.py')
-rw-r--r--testsuite/Testsrc/Testlib/TestOptions/__init__.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/testsuite/Testsrc/Testlib/TestOptions/__init__.py b/testsuite/Testsrc/Testlib/TestOptions/__init__.py
index ca2c41359..e92f95e94 100644
--- a/testsuite/Testsrc/Testlib/TestOptions/__init__.py
+++ b/testsuite/Testsrc/Testlib/TestOptions/__init__.py
@@ -32,8 +32,10 @@ class make_config(object): # pylint: disable=invalid-name
config_file.close()
args = list(args) + [name]
- rv = func(*args, **kwargs)
- os.unlink(name)
+ try:
+ rv = func(*args, **kwargs)
+ finally:
+ os.unlink(name)
return rv
return inner