From b50d7b239f5b6530873df25a80dde484f955581c Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Wed, 22 Oct 2014 12:53:54 -0500 Subject: testsuite: unlink temporary files This cleans up the temporary config files created by the option parsing unit tests. Courtesy Alexander Sulfrian. --- testsuite/Testsrc/Testlib/TestOptions/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'testsuite/Testsrc/Testlib/TestOptions/__init__.py') 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 -- cgit v1.2.3-1-g7c22