]> granicus.if.org Git - python/commitdiff
Skip the ioctl test if we can't open /dev/tty. This happens on
authorNeal Norwitz <nnorwitz@gmail.com>
Thu, 20 Mar 2003 04:33:16 +0000 (04:33 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Thu, 20 Mar 2003 04:33:16 +0000 (04:33 +0000)
Solaris (and probably other Unixes) when run without a terminal
(eg, from cron or at).

Lib/test/test_ioctl.py

index a6a59c5a4e10f53420f9b9081f0345bfc98d3785..959d16e59249fa4307a3237eb05704e010d07c9a 100644 (file)
@@ -8,6 +8,12 @@ except ImportError:
 if not hasattr(termios,'TIOCGPGRP'):
     raise TestSkipped("termios module doesn't have TIOCGPGRP")
 
+try:
+    tty = open("/dev/tty", "r")
+    tty.close()
+except IOError:
+    raise TestSkipped("Unable to open /dev/tty")
+
 class IoctlTests(unittest.TestCase):
     def test_ioctl(self):
         pgrp = os.getpgrp()