]> granicus.if.org Git - python/commitdiff
also skip test_device_encoding when stdin isn't a tty
authorPhilip Jenvey <pjenvey@underboss.org>
Thu, 1 Mar 2012 00:16:15 +0000 (16:16 -0800)
committerPhilip Jenvey <pjenvey@underboss.org>
Thu, 1 Mar 2012 00:16:15 +0000 (16:16 -0800)
Lib/test/test_os.py

index 5959d1e31dc6772cbe8df0d85d70a0e600b49ba1..e0c59fd3f3ca5f276cef14d8a3070ed59f5bc581 100644 (file)
@@ -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)