[Piglit] [PATCH 3/4] crucible: ensure tempfile is removed even if there's an error.
Dylan Baker
dylan at pnwbakers.com
Wed May 2 20:57:54 UTC 2018
---
tests/crucible.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tests/crucible.py b/tests/crucible.py
index 71ccf9d70..476869a31 100644
--- a/tests/crucible.py
+++ b/tests/crucible.py
@@ -57,11 +57,13 @@ class CrucibleTest(Test):
super(CrucibleTest, self).__init__(command)
def interpret_result(self):
- test = backends.junit.REGISTRY.load(self.__out_xml, 'none')
- result = test.get_result(next(six.iterkeys(test.tests)))
- self.result.result = result.name
- super(CrucibleTest, self).interpret_result()
- os.remove(self.__out_xml)
+ try:
+ test = backends.junit.REGISTRY.load(self.__out_xml, 'none')
+ result = test.get_result(next(six.iterkeys(test.tests)))
+ self.result.result = result.name
+ super(CrucibleTest, self).interpret_result()
+ finally:
+ os.remove(self.__out_xml)
def gen_caselist_txt(bin_):
with open('crucible.txt', 'w') as d:
--
2.17.0
More information about the Piglit
mailing list