summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ioctl.py
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2010-08-09 20:02:00 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2010-08-09 20:02:00 (GMT)
commit172e15fdd6605b87119cd79da67498809674e2c7 (patch)
tree870d24f432aba951cf5e1f783d93a436fc86973f /Lib/test/test_ioctl.py
parent45c67c3efe27bf9ddc9d67484aa8464fccee2b1d (diff)
downloadcpython-172e15fdd6605b87119cd79da67498809674e2c7.zip
cpython-172e15fdd6605b87119cd79da67498809674e2c7.tar.gz
cpython-172e15fdd6605b87119cd79da67498809674e2c7.tar.bz2
Merged revisions 83833,83838-83839,83859,83878 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83833 | florent.xicluna | 2010-08-08 18:25:27 +0200 (dim., 08 août 2010) | 2 lines Add test case for the HTTPResponse being an iterable. Follow-up of issue #4608. ........ r83838 | florent.xicluna | 2010-08-08 20:03:44 +0200 (dim., 08 août 2010) | 2 lines Typo. ........ r83839 | florent.xicluna | 2010-08-08 20:06:13 +0200 (dim., 08 août 2010) | 2 lines Issue #7564: Skip test_ioctl if another process is attached to /dev/tty. ........ r83859 | florent.xicluna | 2010-08-09 00:07:16 +0200 (lun., 09 août 2010) | 2 lines Fix #8530: Prevent stringlib fastsearch from reading beyond the front of an array. ........ r83878 | florent.xicluna | 2010-08-09 10:29:08 +0200 (lun., 09 août 2010) | 1 line Merge the 2to3 script from /sandbox/trunk/2to3/2to3, revision 72867 (latest). ........
Diffstat (limited to 'Lib/test/test_ioctl.py')
-rw-r--r--Lib/test/test_ioctl.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_ioctl.py b/Lib/test/test_ioctl.py
index 7fc9c08..51da6a3 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