Skip to content

Commit be54e3e

Browse files
authored
Narrow exception type when attempting to handle test failures. NFC (#20852)
`self.failureException` is the exception type that is thrown when a test fails.
1 parent 2b426d4 commit be54e3e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ def _build_and_run(self, filename, expected_output, args=None, output_nicerizer=
16381638
self.assertContained(expected_output, js_output, regex=regex)
16391639
if assert_returncode == 0 and check_for_error:
16401640
self.assertNotContained('ERROR', js_output)
1641-
except Exception:
1641+
except self.failureException:
16421642
print('(test did not pass in JS engine: %s)' % engine)
16431643
raise
16441644
return js_output
@@ -1982,7 +1982,7 @@ def run_browser(self, html_file, expected=None, message=None, timeout=None, extr
19821982
output = unquote(output)
19831983
try:
19841984
self.assertContained(expected, output)
1985-
except Exception as e:
1985+
except self.failureException as e:
19861986
if extra_tries > 0:
19871987
print('[test error (see below), automatically retrying]')
19881988
print(e)

0 commit comments

Comments
 (0)