Skip to content

Commit 267989e

Browse files
authored
Don't keep exceptions alive after the test finishes
Clearing the exceptions found during a test is needed to allow variables to be properly cleared. Fixes pytest-dev#187
1 parent 5d47c68 commit 267989e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pytestqt/exceptions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ def fail_if_exceptions_occurred(self, when):
5858
exceptions = self.exceptions
5959
self.exceptions = []
6060
prefix = '%s ERROR: ' % when
61-
pytest.fail(prefix + format_captured_exceptions(exceptions),
61+
msg = prefix + format_captured_exceptions(exceptions)
62+
del exceptions[:] # Don't keep exceptions alive longer.
63+
pytest.fail(msg,
6264
pytrace=False)
6365

6466

0 commit comments

Comments
 (0)