]> granicus.if.org Git - python/commitdiff
Issue #25703: Skip test_43581 if one of stdout or stderr is redirected.
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 25 Nov 2015 14:20:04 +0000 (16:20 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 25 Nov 2015 14:20:04 +0000 (16:20 +0200)
Lib/test/test_sys.py

index ab35ba48a7cdcb00fddf315898e63861cf7528bf..de13f2204b528b6c4e45abcbe500a1df55448ff7 100644 (file)
@@ -412,7 +412,10 @@ class SysModuleTest(unittest.TestCase):
     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)