[Python-checkins] cpython: Suppress assert dialogs in test_os

steve.dower python-checkins at python.org
Sun Mar 8 06:25:57 CET 2015


https://hg.python.org/cpython/rev/3e12444adf1e
changeset:   94901:3e12444adf1e
user:        Steve Dower <steve.dower at microsoft.com>
date:        Sat Mar 07 21:25:54 2015 -0800
summary:
  Suppress assert dialogs in test_os

files:
  Lib/test/test_os.py |  24 ++++++++++++++----------
  1 files changed, 14 insertions(+), 10 deletions(-)


diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -1199,8 +1199,10 @@
         code = """if 1:
             import os
             import sys
+            import test.support
             os.urandom(4)
-            os.closerange(3, 256)
+            with test.support.SuppressCrashReport():
+                os.closerange(3, 256)
             sys.stdout.buffer.write(os.urandom(4))
             """
         rc, out, err = assert_python_ok('-Sc', code)
@@ -1214,16 +1216,18 @@
         code = """if 1:
             import os
             import sys
+            import test.support
             os.urandom(4)
-            for fd in range(3, 256):
-                try:
-                    os.close(fd)
-                except OSError:
-                    pass
-                else:
-                    # Found the urandom fd (XXX hopefully)
-                    break
-            os.closerange(3, 256)
+            with test.support.SuppressCrashReport():
+                for fd in range(3, 256):
+                    try:
+                        os.close(fd)
+                    except OSError:
+                        pass
+                    else:
+                        # Found the urandom fd (XXX hopefully)
+                        break
+                os.closerange(3, 256)
             with open({TESTFN!r}, 'rb') as f:
                 os.dup2(f.fileno(), fd)
                 sys.stdout.buffer.write(os.urandom(4))

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


More information about the Python-checkins mailing list