From: Philip Jenvey Date: Thu, 1 Mar 2012 00:16:15 +0000 (-0800) Subject: also skip test_device_encoding when stdin isn't a tty X-Git-Tag: v3.3.0a1~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e308b7c0c0e31e1c4d6f82365ea9f7a6e21ec6fb;p=python also skip test_device_encoding when stdin isn't a tty --- diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 5959d1e31d..e0c59fd3f3 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1433,8 +1433,8 @@ class DeviceEncodingTests(unittest.TestCase): # Return None when an fd doesn't actually exist. self.assertIsNone(os.device_encoding(123456)) - @unittest.skipUnless(sys.platform.startswith('win') or - (hasattr(locale, 'nl_langinfo') and hasattr(locale, 'CODESET')), + @unittest.skipUnless(os.isatty(0) and (sys.platform.startswith('win') or + (hasattr(locale, 'nl_langinfo') and hasattr(locale, 'CODESET'))), 'test requires either Windows or nl_langinfo(CODESET)') def test_device_encoding(self): encoding = os.device_encoding(0)