[pypy-commit] pypy default: Don't hardcode termios values.
Gabriel
noreply at buildbot.pypy.org
Thu Oct 18 15:28:25 CEST 2012
Author: Gabriel <g2p.code at gmail.com>
Branch:
Changeset: r58212:5d789b85d678
Date: 2012-10-18 14:56 +0200
http://bitbucket.org/pypy/pypy/changeset/5d789b85d678/
Log: Don't hardcode termios values.
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
@@ -13,7 +13,7 @@
class AppTestFcntl:
def setup_class(cls):
- space = gettestobjspace(usemodules=('fcntl', 'array', 'struct'))
+ space = gettestobjspace(usemodules=('fcntl', 'array', 'struct', 'termios'))
cls.space = space
tmpprefix = str(udir.ensure('test_fcntl', dir=1).join('tmp_'))
cls.w_tmp = space.wrap(tmpprefix)
@@ -136,11 +136,9 @@
import array
import sys, os
- if "linux" in sys.platform:
- TIOCGPGRP = 0x540f
- elif "darwin" in sys.platform or "freebsd" in sys.platform:
- TIOCGPGRP = 0x40047477
- else:
+ try:
+ from termios import TIOCGPGRP
+ except ImportError:
skip("don't know how to test ioctl() on this platform")
raises(TypeError, fcntl.ioctl, "foo")
@@ -174,9 +172,11 @@
def test_ioctl_int(self):
import os
import fcntl
- #from termios import TCFLSH, TCIOFLUSH
- TCFLSH = 0x540b
- TCIOFLUSH = 2
+
+ try:
+ from termios import TCFLSH, TCIOFLUSH
+ except ImportError:
+ skip("don't know how to test ioctl() on this platform")
if not os.isatty(0):
skip("stdin is not a tty")
More information about the pypy-commit
mailing list