Author: Ronan Lamy <[email protected]>
Branch: follow_symlinks
Changeset: r83328:7682a6f35d12
Date: 2016-03-25 01:08 +0000
http://bitbucket.org/pypy/pypy/changeset/7682a6f35d12/
Log: Split off interp-level tests from test_posix2.py
This prevents -A tests from trying to import hypothesis.
diff --git a/pypy/module/posix/test/test_posix2.py
b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -1,22 +1,14 @@
-
# -*- coding: utf-8 -*-
-from __future__ import with_statement
import os
import py
import sys
import signal
-from pypy.objspace.std import StdObjSpace
from rpython.tool.udir import udir
from pypy.tool.pytest.objspace import gettestobjspace
-from pypy.conftest import pypydir
from rpython.translator.c.test.test_extfunc import need_sparse_files
from rpython.rlib import rposix
-from pypy.module.posix.interp_posix import convert_seconds
-
-from hypothesis import given
-from hypothesis.strategies import integers
def setup_module(mod):
@@ -52,7 +44,6 @@
# space.call_method(space.getbuiltinmodule('sys'), 'getfilesystemencoding')
-
GET_POSIX = "(): import %s as m ; return m" % os.name
@@ -1249,38 +1240,6 @@
assert content == b"test"
-class TestPexpect(object):
- # XXX replace with AppExpectTest class as soon as possible
- def setup_class(cls):
- try:
- import pexpect
- except ImportError:
- py.test.skip("pexpect not found")
-
- def _spawn(self, *args, **kwds):
- import pexpect
- kwds.setdefault('timeout', 600)
- print 'SPAWN:', args, kwds
- child = pexpect.spawn(*args, maxread=5000, **kwds)
- child.logfile = sys.stdout
- return child
-
- def spawn(self, argv):
- py_py = py.path.local(pypydir).join('bin', 'pyinteractive.py')
- return self._spawn(sys.executable, [str(py_py), '-S'] + argv)
-
- def test_ttyname(self):
- source = py.code.Source("""
- import os, sys
- assert os.ttyname(sys.stdin.fileno())
- print('ok!')
- """)
- f = udir.join("test_ttyname.py")
- f.write(source)
- child = self.spawn([str(f)])
- child.expect('ok!')
-
-
class AppTestFdVariants:
# Tests variant functions which also accept file descriptors,
# dir_fd and follow_symlinks.
@@ -1294,16 +1253,3 @@
if os.name == 'posix':
assert os.open in os.supports_dir_fd # openat()
-
-def test_convert_seconds_simple(space):
- w_time = space.wrap(123.456)
- assert convert_seconds(space, w_time) == (123, 456000000)
-
-@given(s=integers(min_value=-2**30, max_value=2**30), ns=integers(min_value=0,
max_value=10**9))
-def test_convert_seconds_full(space, s, ns):
- w_time = space.wrap(s + ns * 1e-9)
- sec, nsec = convert_seconds(space, w_time)
- assert 0 <= nsec < 1e9
- MAX_ERR = 1e9 / 2**23 + 1 # nsec has 53 - 30 = 23 bits of precisin
- err = (sec * 10**9 + nsec) - (s * 10**9 + ns)
- assert -MAX_ERR < err < MAX_ERR
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit