Issue 23314: SuppressCrashReports now disables CRT assertions

SuppressCrashReports should be used in test subprocesses that test invalid conditions.
This commit is contained in:
Steve Dower 2015-02-23 07:56:13 -08:00
parent 7caa615fb0
commit c55a316cff
2 changed files with 45 additions and 16 deletions

View file

@ -4,22 +4,24 @@
import sys
import os
from test.support import SuppressCrashReport
verbose = (sys.argv[1] == 'v')
try:
fd = int(sys.argv[2])
with SuppressCrashReport():
verbose = (sys.argv[1] == 'v')
try:
os.write(fd, b"blat")
except OSError:
# Success -- could not write to fd.
sys.exit(0)
else:
if verbose:
sys.stderr.write("fd %d is open in child" % fd)
sys.exit(1)
fd = int(sys.argv[2])
except Exception:
if verbose:
raise
sys.exit(1)
try:
os.write(fd, b"blat")
except OSError:
# Success -- could not write to fd.
sys.exit(0)
else:
if verbose:
sys.stderr.write("fd %d is open in child" % fd)
sys.exit(1)
except Exception:
if verbose:
raise
sys.exit(1)