Issue #23919: Prevents assert dialogs appearing in the test suite.
authorSteve Dower <steve.dower@microsoft.com>
Thu, 8 Oct 2015 15:56:06 +0000 (08:56 -0700)
committerSteve Dower <steve.dower@microsoft.com>
Thu, 8 Oct 2015 15:56:06 +0000 (08:56 -0700)
Lib/test/regrtest.py
Misc/NEWS

index a04c3f78b2149d989bb957072924ec724d9b586d..c246fe03084657410dee4f7f4dd865e9d0954c52 100755 (executable)
@@ -511,7 +511,13 @@ def main(tests=None, **kwargs):
         import gc
         gc.set_threshold(ns.threshold)
     if ns.nowindows:
+        print('The --nowindows (-n) option is deprecated. '
+              'Use -vv to display assertions in stderr.')
+    try:
         import msvcrt
+    except ImportError:
+        pass
+    else:
         msvcrt.SetErrorMode(msvcrt.SEM_FAILCRITICALERRORS|
                             msvcrt.SEM_NOALIGNMENTFAULTEXCEPT|
                             msvcrt.SEM_NOGPFAULTERRORBOX|
@@ -523,8 +529,11 @@ def main(tests=None, **kwargs):
             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)
     if ns.wait:
         input("Press any key to continue...")
 
index e055bd5db00304237b11502e228841ddc1e203c0..cfa15415d2d42f9a9bd20a2d96233ada1e04f461 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -278,6 +278,8 @@ Documentation
 Tests
 -----
 
+- Issue #23919: Prevents assert dialogs appearing in the test suite.
+
 - PCbuild\rt.bat now accepts an unlimited number of arguments to pass along
   to regrtest.py.  Previously there was a limit of 9.