Skip the ioctl test if we can't open /dev/tty. This happens on

Solaris (and probably other Unixes) when run without a terminal
(eg, from cron or at).
This commit is contained in:
Neal Norwitz 2003-03-20 04:33:16 +00:00
parent fe94e97e48
commit 26f42f6821
1 changed files with 6 additions and 0 deletions

View 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()