tests: cleanup tracebacks also for expectedFailure exception

Continuation of 5bc0baea "tests: do not leak objects in object leaks
checking function".
This commit is contained in:
Marek Marczykowski-Górecki 2018-10-12 14:41:35 +02:00
parent c45ce78ee4
commit 00c0b4c69f
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -386,9 +386,11 @@ class QubesTestCase(unittest.TestCase):
'''Remove local variables reference from tracebacks to allow garbage
collector to clean all Qubes*() objects, otherwise file descriptors
held by them will leak'''
for test_case, exc_info in self._outcome.errors:
if test_case is not self:
continue
exc_infos = [e for test_case, e in self._outcome.errors
if test_case is self]
if self._outcome.expectedFailure:
exc_infos.append(self._outcome.expectedFailure)
for exc_info in exc_infos:
if exc_info is None:
continue
ex = exc_info[1]