summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fileio.py
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2007-07-12 11:29:02 (GMT)
committerThomas Heller <theller@ctypes.org>2007-07-12 11:29:02 (GMT)
commitb0f48abd876f4484ef7c2bb0cacb78d221935db2 (patch)
tree1535606d769c992e9beeb17ec1b787ddb9420795 /Lib/test/test_fileio.py
parentfdeee3a6cdadee0e32dcec9783b1aaa5e231bdf6 (diff)
downloadcpython-b0f48abd876f4484ef7c2bb0cacb78d221935db2.zip
cpython-b0f48abd876f4484ef7c2bb0cacb78d221935db2.tar.gz
cpython-b0f48abd876f4484ef7c2bb0cacb78d221935db2.tar.bz2
Skip testing the special file "/dev/tty" on Windows. This test does
weird things if someone has a "\dev" directory on the current drive.
Diffstat (limited to 'Lib/test/test_fileio.py')
-rw-r--r--Lib/test/test_fileio.py33
1 files changed, 17 insertions, 16 deletions
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index 8cf79df..8fd77e5 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -124,22 +124,23 @@ class OtherFileTests(unittest.TestCase):
self.assertEquals(f.isatty(), False)
f.close()
- try:
- f = _fileio._FileIO("/dev/tty", "a")
- except EnvironmentError:
- # When run in a cron job there just aren't any ttys,
- # so skip the test. This also handles Windows and
- # other OS'es that don't support /dev/tty.
- pass
- else:
- f = _fileio._FileIO("/dev/tty", "a")
- self.assertEquals(f.readable(), False)
- self.assertEquals(f.writable(), True)
- if sys.platform != "darwin":
- # Somehow /dev/tty appears seekable on OSX
- self.assertEquals(f.seekable(), False)
- self.assertEquals(f.isatty(), True)
- f.close()
+ if sys.platform != "win32":
+ try:
+ f = _fileio._FileIO("/dev/tty", "a")
+ except EnvironmentError:
+ # When run in a cron job there just aren't any
+ # ttys, so skip the test. This also handles other
+ # OS'es that don't support /dev/tty.
+ pass
+ else:
+ f = _fileio._FileIO("/dev/tty", "a")
+ self.assertEquals(f.readable(), False)
+ self.assertEquals(f.writable(), True)
+ if sys.platform != "darwin":
+ # Somehow /dev/tty appears seekable on OSX
+ self.assertEquals(f.seekable(), False)
+ self.assertEquals(f.isatty(), True)
+ f.close()
finally:
os.unlink(TESTFN)