mirror of
https://github.com/python/cpython.git
synced 2025-09-28 03:13:48 +00:00
Skip testing the special file "/dev/tty" on Windows. This test does
weird things if someone has a "\dev" directory on the current drive.
This commit is contained in:
parent
fdeee3a6cd
commit
b0f48abd87
1 changed files with 17 additions and 16 deletions
|
@ -124,22 +124,23 @@ class OtherFileTests(unittest.TestCase):
|
||||||
self.assertEquals(f.isatty(), False)
|
self.assertEquals(f.isatty(), False)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
try:
|
if sys.platform != "win32":
|
||||||
f = _fileio._FileIO("/dev/tty", "a")
|
try:
|
||||||
except EnvironmentError:
|
f = _fileio._FileIO("/dev/tty", "a")
|
||||||
# When run in a cron job there just aren't any ttys,
|
except EnvironmentError:
|
||||||
# so skip the test. This also handles Windows and
|
# When run in a cron job there just aren't any
|
||||||
# other OS'es that don't support /dev/tty.
|
# ttys, so skip the test. This also handles other
|
||||||
pass
|
# OS'es that don't support /dev/tty.
|
||||||
else:
|
pass
|
||||||
f = _fileio._FileIO("/dev/tty", "a")
|
else:
|
||||||
self.assertEquals(f.readable(), False)
|
f = _fileio._FileIO("/dev/tty", "a")
|
||||||
self.assertEquals(f.writable(), True)
|
self.assertEquals(f.readable(), False)
|
||||||
if sys.platform != "darwin":
|
self.assertEquals(f.writable(), True)
|
||||||
# Somehow /dev/tty appears seekable on OSX
|
if sys.platform != "darwin":
|
||||||
self.assertEquals(f.seekable(), False)
|
# Somehow /dev/tty appears seekable on OSX
|
||||||
self.assertEquals(f.isatty(), True)
|
self.assertEquals(f.seekable(), False)
|
||||||
f.close()
|
self.assertEquals(f.isatty(), True)
|
||||||
|
f.close()
|
||||||
finally:
|
finally:
|
||||||
os.unlink(TESTFN)
|
os.unlink(TESTFN)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue