]> granicus.if.org Git - python/commitdiff
Skip testing the special file "/dev/tty" on Windows. This test does
authorThomas Heller <theller@ctypes.org>
Thu, 12 Jul 2007 11:29:02 +0000 (11:29 +0000)
committerThomas Heller <theller@ctypes.org>
Thu, 12 Jul 2007 11:29:02 +0000 (11:29 +0000)
weird things if someone has a "\dev" directory on the current drive.

Lib/test/test_fileio.py

index 8cf79df370ea4acd48b38f8675b843ffa9dae025..8fd77e521389b934fc134ed6ac540f31a69fc257 100644 (file)
@@ -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)