[pypy-svn] r61237 - pypy/trunk/lib-python/modified-2.5.2/test

fijal at codespeak.net fijal at codespeak.net
Thu Jan 22 15:36:00 CET 2009


Author: fijal
Date: Thu Jan 22 15:36:00 2009
New Revision: 61237

Modified:
   pypy/trunk/lib-python/modified-2.5.2/test/test_file.py
Log:
this test looks bogus anyway, but let's skip it if stdin is not a tty


Modified: pypy/trunk/lib-python/modified-2.5.2/test/test_file.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/test/test_file.py	(original)
+++ pypy/trunk/lib-python/modified-2.5.2/test/test_file.py	Thu Jan 22 15:36:00 2009
@@ -140,14 +140,15 @@
                 self.fail('%r is an invalid file mode' % mode)
 
     def testStdin(self):
-        # This causes the interpreter to exit on OSF1 v5.1.
-        if sys.platform != 'osf1V5':
-            self.assertRaises(IOError, sys.stdin.seek, -1)
-        else:
-            print >>sys.__stdout__, (
-                '  Skipping sys.stdin.seek(-1), it may crash the interpreter.'
-                ' Test manually.')
-        self.assertRaises(IOError, sys.stdin.truncate)
+        if os.isatty(sys.stdin.fileno()):
+            # This causes the interpreter to exit on OSF1 v5.1.
+            if sys.platform != 'osf1V5':
+                self.assertRaises(IOError, sys.stdin.seek, -1)
+            else:
+                print >>sys.__stdout__, (
+                    '  Skipping sys.stdin.seek(-1), it may crash the interpreter.'
+                    ' Test manually.')
+            self.assertRaises(IOError, sys.stdin.truncate)
 
     def testUnicodeOpen(self):
         # verify repr works for unicode too



More information about the Pypy-commit mailing list