diff options
author | Steve Dower <steve.dower@microsoft.com> | 2015-02-23 15:56:13 (GMT) |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2015-02-23 15:56:13 (GMT) |
commit | c55a316cff6723a22dbe57b2e9d0d25b5387226d (patch) | |
tree | 275964eeb85e49a1228def514cc825c35c8cb887 /Lib/test/tf_inherit_check.py | |
parent | 7caa615fb02eab96b237af05a19e0a347e240aeb (diff) | |
download | cpython-c55a316cff6723a22dbe57b2e9d0d25b5387226d.zip cpython-c55a316cff6723a22dbe57b2e9d0d25b5387226d.tar.gz cpython-c55a316cff6723a22dbe57b2e9d0d25b5387226d.tar.bz2 |
Issue 23314: SuppressCrashReports now disables CRT assertions
SuppressCrashReports should be used in test subprocesses that test invalid conditions.
Diffstat (limited to 'Lib/test/tf_inherit_check.py')
-rw-r--r-- | Lib/test/tf_inherit_check.py | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/Lib/test/tf_inherit_check.py b/Lib/test/tf_inherit_check.py index afe50d2..138f25a 100644 --- a/Lib/test/tf_inherit_check.py +++ b/Lib/test/tf_inherit_check.py @@ -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: + fd = int(sys.argv[2]) + + 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: - sys.stderr.write("fd %d is open in child" % fd) + raise sys.exit(1) - -except Exception: - if verbose: - raise - sys.exit(1) |