[Python-checkins] cpython: Issue #25306: Try to fix test_huntrleaks_fd_leak() on Windows

victor.stinner python-checkins at python.org
Sat Oct 3 15:41:01 EDT 2015


https://hg.python.org/cpython/rev/850efcc9155c
changeset:   98525:850efcc9155c
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Oct 03 21:40:21 2015 +0200
summary:
  Issue #25306: Try to fix test_huntrleaks_fd_leak() on Windows

Issue #25306: Disable popup and logs to stderr on assertion failures in MSCRT.

files:
  Lib/test/test_regrtest.py |  14 ++++++++++++--
  1 files changed, 12 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -643,14 +643,24 @@
         self.check_executed_tests(output, [test]*3, failed=test)
 
     @unittest.skipUnless(Py_DEBUG, 'need a debug build')
-    # Issue #25306: the test hangs sometimes on Windows
-    @unittest.skipIf(sys.platform == 'win32', 'test broken on Windows')
     def test_huntrleaks_fd_leak(self):
         # test --huntrleaks for file descriptor leak
         code = textwrap.dedent("""
             import os
             import unittest
 
+            # Issue #25306: Disable popups and logs to stderr on assertion
+            # failures in MSCRT
+            try:
+                import msvcrt
+                msvcrt.CrtSetReportMode
+            except (ImportError, AttributeError):
+                # no Windows, o release build
+                pass
+            else:
+                for m in [msvcrt.CRT_WARN, msvcrt.CRT_ERROR, msvcrt.CRT_ASSERT]:
+                    msvcrt.CrtSetReportMode(m, 0)
+
             class FDLeakTest(unittest.TestCase):
                 def test_leak(self):
                     fd = os.open(__file__, os.O_RDONLY)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list