diff -r 8d7bde14d7a4 Lib/test/test_os.py --- a/Lib/test/test_os.py Thu Jun 30 11:43:19 2016 -0700 +++ b/Lib/test/test_os.py Fri Jul 01 02:57:25 2016 +0000 @@ -134,8 +134,9 @@ finally: os.close(second) # close a fd that is open, and one that isn't - os.closerange(first, first + 2) - self.assertRaises(OSError, os.write, first, b"a") + with support.SuppressCrashReport(): + os.closerange(first, first + 2) + self.assertRaises(OSError, os.write, first, b"a") @support.cpython_only def test_rename(self): @@ -422,7 +423,8 @@ os.close(r) os.close(w) with self.assertRaises(OSError) as ctx: - os.stat(r) + with support.SuppressCrashReport(): + os.stat(r) self.assertEqual(ctx.exception.errno, errno.EBADF) def check_file_attributes(self, result): @@ -1475,7 +1477,8 @@ def check(self, f, *args): try: - f(support.make_bad_fd(), *args) + with support.SuppressCrashReport(): + f(support.make_bad_fd(), *args) except OSError as e: self.assertEqual(e.errno, errno.EBADF) else: @@ -1484,23 +1487,25 @@ @unittest.skipUnless(hasattr(os, 'isatty'), 'test needs os.isatty()') def test_isatty(self): - self.assertEqual(os.isatty(support.make_bad_fd()), False) + with support.SuppressCrashReport(): + self.assertEqual(os.isatty(support.make_bad_fd()), False) @unittest.skipUnless(hasattr(os, 'closerange'), 'test needs os.closerange()') def test_closerange(self): fd = support.make_bad_fd() # Make sure none of the descriptors we are about to close are # currently valid (issue 6542). - for i in range(10): - try: os.fstat(fd+i) - except OSError: - pass - else: - break - if i < 2: - raise unittest.SkipTest( - "Unable to acquire a range of invalid file descriptors") - self.assertEqual(os.closerange(fd, fd + i-1), None) + with support.SuppressCrashReport(): + for i in range(10): + try: os.fstat(fd+i) + except OSError: + pass + else: + break + if i < 2: + raise unittest.SkipTest( + "Unable to acquire a range of invalid file descriptors") + self.assertEqual(os.closerange(fd, fd + i-1), None) @unittest.skipUnless(hasattr(os, 'dup2'), 'test needs os.dup2()') def test_dup2(self): @@ -2085,7 +2090,8 @@ def test_bad_fd(self): # Return None when an fd doesn't actually exist. - self.assertIsNone(os.device_encoding(123456)) + with support.SuppressCrashReport(): + self.assertIsNone(os.device_encoding(123456)) @unittest.skipUnless(os.isatty(0) and (sys.platform.startswith('win') or (hasattr(locale, 'nl_langinfo') and hasattr(locale, 'CODESET'))),