diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-08-08 18:06:13 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-08-08 18:06:13 (GMT) |
commit | 39d795d8c1a1b2feaff407a8d583eb2fc16f2475 (patch) | |
tree | 6c13a713d480df3b17e41873667a8ff8a2a1bdad /Lib/test | |
parent | e7eaec699ec03217a0800d4b4b3f63c4a98b2200 (diff) | |
download | cpython-39d795d8c1a1b2feaff407a8d583eb2fc16f2475.zip cpython-39d795d8c1a1b2feaff407a8d583eb2fc16f2475.tar.gz cpython-39d795d8c1a1b2feaff407a8d583eb2fc16f2475.tar.bz2 |
Issue #7564: Skip test_ioctl if another process is attached to /dev/tty.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_ioctl.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_ioctl.py b/Lib/test/test_ioctl.py index 47e5911..07dac09 100644 --- a/Lib/test/test_ioctl.py +++ b/Lib/test/test_ioctl.py @@ -7,9 +7,17 @@ get_attribute(termios, 'TIOCGPGRP') #Can't run tests without this feature try: tty = open("/dev/tty", "r") - tty.close() except IOError: raise unittest.SkipTest("Unable to open /dev/tty") +else: + # Skip if another process is in foreground + r = fcntl.ioctl(tty, termios.TIOCGPGRP, " ") + tty.close() + rpgrp = struct.unpack("i", r)[0] + if rpgrp not in (os.getpgrp(), os.getsid(0)): + raise unittest.SkipTest("Neither the process group nor the session " + "are attached to /dev/tty") + del tty, r, rpgrp try: import pty |