[pypy-commit] pypy default: Merged in bdkearns/pypy (pull request #98: more correct fix for test_ioctl)
arigo
noreply at buildbot.pypy.org
Mon Dec 17 11:30:29 CET 2012
Author: arigo <armin.rigo at gmail.com>
Branch:
Changeset: r59469:cc4e5c0d5b78
Date: 2012-12-17 11:30 +0100
http://bitbucket.org/pypy/pypy/changeset/cc4e5c0d5b78/
Log: Merged in bdkearns/pypy (pull request #98: more correct fix for
test_ioctl)
diff --git a/pypy/module/fcntl/test/test_fcntl.py b/pypy/module/fcntl/test/test_fcntl.py
--- a/pypy/module/fcntl/test/test_fcntl.py
+++ b/pypy/module/fcntl/test/test_fcntl.py
@@ -11,7 +11,7 @@
os.unlink(i)
class AppTestFcntl:
- spaceconfig = dict(usemodules=('fcntl', 'array', 'struct', 'termios'))
+ spaceconfig = dict(usemodules=('fcntl', 'array', 'struct', 'termios', 'select', 'time'))
def setup_class(cls):
tmpprefix = str(udir.ensure('test_fcntl', dir=1).join('tmp_'))
cls.w_tmp = cls.space.wrap(tmpprefix)
@@ -174,6 +174,8 @@
import fcntl
import array
import os
+ import pty
+ import time
try:
from termios import TIOCGPGRP
@@ -185,10 +187,11 @@
#raises(TypeError, fcntl.ioctl, 0, TIOCGPGRP, float(0))
raises(TypeError, fcntl.ioctl, 0, TIOCGPGRP, 1, "foo")
- try:
- mfd = open("/dev/tty", 'r')
- except IOError:
- skip("couldn't open /dev/tty")
+ child_pid, mfd = pty.fork()
+ if child_pid == 0:
+ # We're the child
+ time.sleep(1)
+ return
try:
buf = array.array('i', [0])
res = fcntl.ioctl(mfd, TIOCGPGRP, buf, True)
@@ -209,25 +212,24 @@
res = fcntl.ioctl(mfd, TIOCGPGRP, "\x00\x00\x00\x00")
assert res == expected
finally:
- mfd.close()
+ os.close(mfd)
def test_ioctl_int(self):
import os
import fcntl
+ import pty
try:
from termios import TCFLSH, TCIOFLUSH
except ImportError:
skip("don't know how to test ioctl() on this platform")
- try:
- mfd = open("/dev/tty", 'r')
- except IOError:
- skip("couldn't open /dev/tty")
+ mfd, sfd = pty.openpty()
try:
assert fcntl.ioctl(mfd, TCFLSH, TCIOFLUSH) == 0
finally:
- mfd.close()
+ os.close(mfd)
+ os.close(sfd)
def test_large_flag(self):
import sys
More information about the pypy-commit
mailing list