Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 12ee744

Browse files
committed
Issue #23919: Prevents assert dialogs appearing in the test suite.
1 parent ce88d82 commit 12ee744

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

Lib/test/regrtest.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,13 @@ def main(tests=None, **kwargs):
511511
import gc
512512
gc.set_threshold(ns.threshold)
513513
if ns.nowindows:
514+
print('The --nowindows (-n) option is deprecated. '
515+
'Use -vv to display assertions in stderr.')
516+
try:
514517
import msvcrt
518+
except ImportError:
519+
pass
520+
else:
515521
msvcrt.SetErrorMode(msvcrt.SEM_FAILCRITICALERRORS|
516522
msvcrt.SEM_NOALIGNMENTFAULTEXCEPT|
517523
msvcrt.SEM_NOGPFAULTERRORBOX|
@@ -523,8 +529,11 @@ def main(tests=None, **kwargs):
523529
pass
524530
else:
525531
for m in [msvcrt.CRT_WARN, msvcrt.CRT_ERROR, msvcrt.CRT_ASSERT]:
526-
msvcrt.CrtSetReportMode(m, msvcrt.CRTDBG_MODE_FILE)
527-
msvcrt.CrtSetReportFile(m, msvcrt.CRTDBG_FILE_STDERR)
532+
if ns.verbose and ns.verbose >= 2:
533+
msvcrt.CrtSetReportMode(m, msvcrt.CRTDBG_MODE_FILE)
534+
msvcrt.CrtSetReportFile(m, msvcrt.CRTDBG_FILE_STDERR)
535+
else:
536+
msvcrt.CrtSetReportMode(m, 0)
528537
if ns.wait:
529538
input("Press any key to continue...")
530539

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ Documentation
278278
Tests
279279
-----
280280

281+
- Issue #23919: Prevents assert dialogs appearing in the test suite.
282+
281283
- PCbuild\rt.bat now accepts an unlimited number of arguments to pass along
282284
to regrtest.py. Previously there was a limit of 9.
283285

0 commit comments

Comments
 (0)