Author: Philip Jenvey <pjen...@underboss.org> Branch: py3k Changeset: r84613:77179513ecd2 Date: 2016-05-22 18:12 -0700 http://bitbucket.org/pypy/pypy/changeset/77179513ecd2/
Log: skip without hypothesis installed diff --git a/pypy/module/posix/test/test_interp_posix.py b/pypy/module/posix/test/test_interp_posix.py --- a/pypy/module/posix/test/test_interp_posix.py +++ b/pypy/module/posix/test/test_interp_posix.py @@ -1,8 +1,6 @@ import sys import py -from hypothesis import given -from hypothesis.strategies import integers from rpython.tool.udir import udir from pypy.conftest import pypydir @@ -44,12 +42,20 @@ 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 +def test_convert_seconds_full(space): + try: + from hypothesis import given + from hypothesis.strategies import integers + except ImportError: + py.test.skip("hypothesis not found") + + @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 + _test_convert_seconds_full(space) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit