Commit 39d795d8 authored by Florent Xicluna's avatar Florent Xicluna

Issue #7564: Skip test_ioctl if another process is attached to /dev/tty.

parent e7eaec69
...@@ -7,9 +7,17 @@ get_attribute(termios, 'TIOCGPGRP') #Can't run tests without this feature ...@@ -7,9 +7,17 @@ get_attribute(termios, 'TIOCGPGRP') #Can't run tests without this feature
try: try:
tty = open("/dev/tty", "r") tty = open("/dev/tty", "r")
tty.close()
except IOError: except IOError:
raise unittest.SkipTest("Unable to open /dev/tty") 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: try:
import pty import pty
......
...@@ -136,6 +136,8 @@ Tools/Demos ...@@ -136,6 +136,8 @@ Tools/Demos
Tests Tests
----- -----
- Issue #7564: Skip test_ioctl if another process is attached to /dev/tty.
- Issue #8433: Fix test_curses failure with newer versions of ncurses. - Issue #8433: Fix test_curses failure with newer versions of ncurses.
- Issue #9496: Provide a test suite for the rlcompleter module. Patch by - Issue #9496: Provide a test suite for the rlcompleter module. Patch by
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment