diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2014-10-22 12:53:54 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2014-11-10 17:35:43 -0600 |
commit | b50d7b239f5b6530873df25a80dde484f955581c (patch) | |
tree | 94608f3d954da7f8a9d1f3aabecee13bfc1c3797 /testsuite/Testsrc/Testlib/TestOptions/__init__.py | |
parent | 4ec92cb9e7d1eb2f90d36e5255ee8814ca0a8513 (diff) | |
download | bcfg2-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__.py | 6 |
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 |