[Python-checkins] cpython (2.7): Issue #25703: Skip test_43581 if one of stdout or stderr is redirected.

serhiy.storchaka python-checkins at python.org
Wed Nov 25 09:20:34 EST 2015


https://hg.python.org/cpython/rev/eb9d2e5bc8dc
changeset:   99351:eb9d2e5bc8dc
branch:      2.7
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Nov 25 16:20:04 2015 +0200
summary:
  Issue #25703: Skip test_43581 if one of stdout or stderr is redirected.

files:
  Lib/test/test_sys.py |  5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -412,7 +412,10 @@
     def test_43581(self):
         # Can't use sys.stdout, as this is a cStringIO object when
         # the test runs under regrtest.
-        self.assertTrue(sys.__stdout__.encoding == sys.__stderr__.encoding)
+        if not (os.environ.get('PYTHONIOENCODING') or
+                (sys.__stdout__.isatty() and sys.__stderr__.isatty())):
+            self.skipTest('stdout/stderr encoding is not set')
+        self.assertEqual(sys.__stdout__.encoding, sys.__stderr__.encoding)
 
     def test_sys_flags(self):
         self.assertTrue(sys.flags)

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


More information about the Python-checkins mailing list