File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -230,14 +230,20 @@ def testModeStrings(self):
230230 else :
231231 f .close ()
232232
233- def testStdin (self ):
234- # This causes the interpreter to exit on OSF1 v5.1.
235- if sys .platform != 'osf1V5' :
236- self .assertRaises (IOError , sys .stdin .seek , - 1 )
237- else :
238- print >> sys .__stdout__ , (
239- ' Skipping sys.stdin.seek(-1), it may crash the interpreter.'
240- ' Test manually.' )
233+ def testStdinSeek (self ):
234+ if sys .platform == 'osf1V5' :
235+ # This causes the interpreter to exit on OSF1 v5.1.
236+ self .skipTest ('Skipping sys.stdin.seek(-1), it may crash '
237+ 'the interpreter. Test manually.' )
238+
239+ if not sys .stdin .isatty ():
240+ # Issue #23168: if stdin is redirected to a file, stdin becomes
241+ # seekable
242+ self .skipTest ('stdin must be a TTY in this test' )
243+
244+ self .assertRaises (IOError , sys .stdin .seek , - 1 )
245+
246+ def testStdinTruncate (self ):
241247 self .assertRaises (IOError , sys .stdin .truncate )
242248
243249 def testUnicodeOpen (self ):
You can’t perform that action at this time.
0 commit comments