#11732: add a new suppress_crash_popup() context manager to test.support.

This commit is contained in:
Ezio Melotti 2013-03-05 20:26:17 +02:00
parent 884f0585a4
commit 25a404520d
5 changed files with 40 additions and 4 deletions

View file

@ -101,7 +101,8 @@ class FaultHandlerTests(unittest.TestCase):
header=re.escape(header))
if other_regex:
regex += '|' + other_regex
output, exitcode = self.get_output(code, filename)
with support.suppress_crash_popup():
output, exitcode = self.get_output(code, filename)
output = '\n'.join(output)
self.assertRegex(output, regex)
self.assertNotEqual(exitcode, 0)
@ -229,7 +230,8 @@ faulthandler.disable()
faulthandler._read_null()
""".strip()
not_expected = 'Fatal Python error'
stderr, exitcode = self.get_output(code)
with support.suppress_crash_popup():
stderr, exitcode = self.get_output(code)
stder = '\n'.join(stderr)
self.assertTrue(not_expected not in stderr,
"%r is present in %r" % (not_expected, stderr))