From: Serhiy Storchaka Date: Wed, 25 Nov 2015 14:20:04 +0000 (+0200) Subject: Issue #25703: Skip test_43581 if one of stdout or stderr is redirected. X-Git-Tag: v2.7.12rc1~370 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1121b5e6a976c82d38698e45a8cf493079b3d1ab;p=thirdparty%2FPython%2Fcpython.git Issue #25703: Skip test_43581 if one of stdout or stderr is redirected. --- diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index ab35ba48a7cd..de13f2204b52 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -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)