[Python-checkins] r83839 - in python/branches/py3k: Lib/test/test_ioctl.py Misc/NEWS

florent.xicluna python-checkins at python.org
Sun Aug 8 20:06:13 CEST 2010


Author: florent.xicluna
Date: Sun Aug  8 20:06:13 2010
New Revision: 83839

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


Modified:
   python/branches/py3k/Lib/test/test_ioctl.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/test/test_ioctl.py
==============================================================================
--- python/branches/py3k/Lib/test/test_ioctl.py	(original)
+++ python/branches/py3k/Lib/test/test_ioctl.py	Sun Aug  8 20:06:13 2010
@@ -7,9 +7,17 @@
 
 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

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sun Aug  8 20:06:13 2010
@@ -136,6 +136,8 @@
 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 #9496: Provide a test suite for the rlcompleter module.  Patch by


More information about the Python-checkins mailing list