Commit 7ba8cdc3 authored by Victor Stinner's avatar Victor Stinner

Issue #23168: skip sys.stdin.seek() test if stdin is not a TTY

parent 6fcb9a51
...@@ -230,14 +230,20 @@ class OtherFileTests(unittest.TestCase): ...@@ -230,14 +230,20 @@ class OtherFileTests(unittest.TestCase):
else: else:
f.close() f.close()
def testStdin(self): def testStdinSeek(self):
if sys.platform == 'osf1V5':
# This causes the interpreter to exit on OSF1 v5.1. # This causes the interpreter to exit on OSF1 v5.1.
if sys.platform != 'osf1V5': self.skipTest('Skipping sys.stdin.seek(-1), it may crash '
'the interpreter. Test manually.')
if not sys.stdin.isatty():
# Issue #23168: if stdin is redirected to a file, stdin becomes
# seekable
self.skipTest('stdin must be a TTY in this test')
self.assertRaises(IOError, sys.stdin.seek, -1) self.assertRaises(IOError, sys.stdin.seek, -1)
else:
print >>sys.__stdout__, ( def testStdinTruncate(self):
' Skipping sys.stdin.seek(-1), it may crash the interpreter.'
' Test manually.')
self.assertRaises(IOError, sys.stdin.truncate) self.assertRaises(IOError, sys.stdin.truncate)
def testUnicodeOpen(self): def testUnicodeOpen(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment