[Python-3000-checkins] r55186 - python/branches/p3yk/Lib/test/test_fileio.py

guido.van.rossum python-3000-checkins at python.org
Tue May 8 19:37:56 CEST 2007


Author: guido.van.rossum
Date: Tue May  8 19:37:51 2007
New Revision: 55186

Modified:
   python/branches/p3yk/Lib/test/test_fileio.py
Log:
Don't die if /dev/tty doesn't exist; just skip that part of the test.


Modified: python/branches/p3yk/Lib/test/test_fileio.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_fileio.py	(original)
+++ python/branches/p3yk/Lib/test/test_fileio.py	Tue May  8 19:37:51 2007
@@ -124,7 +124,14 @@
             self.assertEquals(f.isatty(), False)
             f.close()
 
-            if not sys.platform.startswith("win"):
+            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)


More information about the Python-3000-checkins mailing list