[Python-checkins] cpython: Issue #23919: Prevents assert dialogs appearing in the test suite.

steve.dower python-checkins at python.org
Thu Oct 8 12:08:04 EDT 2015


https://hg.python.org/cpython/rev/62897db9ae51
changeset: 98598:62897db9ae51
parent: 98596:ed47b841f02e
user: Steve Dower <steve.dower at microsoft.com>
date: Thu Oct 08 09:05:36 2015 -0700
summary:
 Issue #23919: Prevents assert dialogs appearing in the test suite.
files:
 Lib/test/libregrtest/cmdline.py | 4 ++++
 Lib/test/libregrtest/setup.py | 12 +++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py
--- a/Lib/test/libregrtest/cmdline.py
+++ b/Lib/test/libregrtest/cmdline.py
@@ -304,6 +304,10 @@
 if ns.pgo and (ns.verbose or ns.verbose2 or ns.verbose3):
 parser.error("--pgo/-v don't go together!")
 
+ if ns.nowindows:
+ print("Warning: the --nowindows (-n) option is deprecated. "
+ "Use -vv to display assertions in stderr.", file=sys.stderr)
+
 if ns.quiet:
 ns.verbose = 0
 if ns.timeout is not None:
diff --git a/Lib/test/libregrtest/setup.py b/Lib/test/libregrtest/setup.py
--- a/Lib/test/libregrtest/setup.py
+++ b/Lib/test/libregrtest/setup.py
@@ -75,8 +75,11 @@
 if ns.threshold is not None:
 gc.set_threshold(ns.threshold)
 
- if ns.nowindows:
+ try:
 import msvcrt
+ except ImportError:
+ pass
+ else:
 msvcrt.SetErrorMode(msvcrt.SEM_FAILCRITICALERRORS|
 msvcrt.SEM_NOALIGNMENTFAULTEXCEPT|
 msvcrt.SEM_NOGPFAULTERRORBOX|
@@ -88,8 +91,11 @@
 pass
 else:
 for m in [msvcrt.CRT_WARN, msvcrt.CRT_ERROR, msvcrt.CRT_ASSERT]:
- msvcrt.CrtSetReportMode(m, msvcrt.CRTDBG_MODE_FILE)
- msvcrt.CrtSetReportFile(m, msvcrt.CRTDBG_FILE_STDERR)
+ if ns.verbose and ns.verbose >= 2:
+ msvcrt.CrtSetReportMode(m, msvcrt.CRTDBG_MODE_FILE)
+ msvcrt.CrtSetReportFile(m, msvcrt.CRTDBG_FILE_STDERR)
+ else:
+ msvcrt.CrtSetReportMode(m, 0)
 
 support.use_resources = ns.use_resources
 
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /