Hello community, here is the log from the commit of package python-hypothesis for openSUSE:Factory checked in at 2018-07-27 10:52:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-hypothesis (Old) and /work/SRC/openSUSE:Factory/.python-hypothesis.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-hypothesis" Fri Jul 27 10:52:07 2018 rev:25 rq:624649 version:3.66.6 Changes: -------- --- /work/SRC/openSUSE:Factory/python-hypothesis/python-hypothesis.changes 2018-07-21 10:09:38.775178581 +0200 +++ /work/SRC/openSUSE:Factory/.python-hypothesis.new/python-hypothesis.changes 2018-07-27 10:52:13.109184389 +0200 @@ -1,0 +2,16 @@ +Mon Jul 23 05:25:06 UTC 2018 - [email protected] + +- update to version 3.66.6: + * This patch ensures that Hypothesis fully supports Python 3.7, by + upgrading from_type() (issue #1264) and fixing some minor issues + in our test suite (issue #1148). + +------------------------------------------------------------------- +Sun Jul 22 18:47:08 UTC 2018 - [email protected] + +- update to version 3.66.5: + * This patch fixes the online docs for various extras, by ensuring + that their dependencies are installed on readthedocs.io (issue + #1326). + +------------------------------------------------------------------- Old: ---- hypothesis-python-3.66.4.tar.gz New: ---- hypothesis-python-3.66.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-hypothesis.spec ++++++ --- /var/tmp/diff_new_pack.zDArEN/_old 2018-07-27 10:52:14.381186825 +0200 +++ /var/tmp/diff_new_pack.zDArEN/_new 2018-07-27 10:52:14.381186825 +0200 @@ -28,7 +28,7 @@ %endif %bcond_without python2 Name: python-hypothesis -Version: 3.66.4 +Version: 3.66.6 Release: 0 Summary: A library for property based testing License: MPL-2.0 ++++++ hypothesis-python-3.66.4.tar.gz -> hypothesis-python-3.66.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.66.4/.rtfd-reqs.txt new/hypothesis-hypothesis-python-3.66.6/.rtfd-reqs.txt --- old/hypothesis-hypothesis-python-3.66.4/.rtfd-reqs.txt 2018-07-20 15:37:18.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.6/.rtfd-reqs.txt 2018-07-23 04:11:59.000000000 +0200 @@ -1,2 +1 @@ -hypothesis-python/ -django +hypothesis-python/[all] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.66.4/.travis.yml new/hypothesis-hypothesis-python-3.66.6/.travis.yml --- old/hypothesis-hypothesis-python-3.66.4/.travis.yml 2018-07-20 15:37:18.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.6/.travis.yml 2018-07-23 04:11:59.000000000 +0200 @@ -81,10 +81,6 @@ matrix: fast_finish: true - allow_failures: - - env: TASK=check-py37 - sudo: required - dist: xenial notifications: email: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/docs/changes.rst new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/docs/changes.rst --- old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/docs/changes.rst 2018-07-20 15:37:18.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/docs/changes.rst 2018-07-23 04:11:59.000000000 +0200 @@ -21,6 +21,25 @@ You should generally assume that an API is internal unless you have specific information to the contrary. +.. _v3.66.6: + +------------------- +3.66.6 - 2018-07-23 +------------------- + +This patch ensures that Hypothesis fully supports Python 3.7, by +upgrading :func:`~hypothesis.strategies.from_type` (:issue:`1264`) +and fixing some minor issues in our test suite (:issue:`1148`). + +.. _v3.66.5: + +------------------- +3.66.5 - 2018-07-22 +------------------- + +This patch fixes the online docs for various extras, by ensuring that +their dependencies are installed on readthedocs.io (:issue:`1326`). + .. _v3.66.4: ------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/src/hypothesis/internal/compat.py new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/src/hypothesis/internal/compat.py --- old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/src/hypothesis/internal/compat.py 2018-07-20 15:37:18.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/src/hypothesis/internal/compat.py 2018-07-23 04:11:59.000000000 +0200 @@ -37,8 +37,13 @@ from ordereddict import OrderedDict # type: ignore from counter import Counter # type: ignore +try: + from collections import abc +except ImportError: + import collections as abc # type: ignore + if False: - from typing import Type # noqa + from typing import Type, Tuple # noqa PY2 = sys.version_info[0] == 2 @@ -273,6 +278,21 @@ return f.__name__ +try: + import typing +except ImportError: + typing_root_type = () # type: Tuple[type, ...] + ForwardRef = None +else: + if hasattr(typing, '_Final'): # new in Python 3.7 + typing_root_type = ( + typing._Final, typing._GenericAlias) # type: ignore + ForwardRef = typing.ForwardRef # type: ignore + else: + typing_root_type = (typing.TypingMeta, typing.TypeVar) # type: ignore + ForwardRef = typing._ForwardRef # type: ignore + + if PY2: FullArgSpec = namedtuple('FullArgSpec', 'args, varargs, varkw, defaults, ' 'kwonlyargs, kwonlydefaults, annotations') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/src/hypothesis/searchstrategy/types.py new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/src/hypothesis/searchstrategy/types.py --- old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/src/hypothesis/searchstrategy/types.py 2018-07-20 15:37:18.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/src/hypothesis/searchstrategy/types.py 2018-07-23 04:11:59.000000000 +0200 @@ -27,27 +27,38 @@ import hypothesis.strategies as st from hypothesis.errors import InvalidArgument, ResolutionFailed -from hypothesis.internal.compat import PY2, text_type +from hypothesis.internal.compat import PY2, ForwardRef, abc, text_type, \ + typing_root_type def type_sorting_key(t): """Minimise to None, then non-container types, then container types.""" - if not isinstance(t, type): + if not is_a_type(t): raise InvalidArgument('thing=%s must be a type' % (t,)) if t is None or t is type(None): # noqa: E721 return (-1, repr(t)) - return (issubclass(t, collections.Container), repr(t)) + if not isinstance(t, type): # pragma: no cover + # Some generics in the typing module are not actually types in 3.7 + return (2, repr(t)) + return (int(issubclass(t, abc.Container)), repr(t)) -def try_issubclass(thing, maybe_superclass): +def try_issubclass(thing, superclass): + thing = getattr(thing, '__origin__', None) or thing + superclass = getattr(superclass, '__origin__', None) or superclass try: - return issubclass(thing, maybe_superclass) + return issubclass(thing, superclass) except (AttributeError, TypeError): # pragma: no cover # Some types can't be the subject or object of an instance or # subclass check under Python 3.5 return False +def is_a_type(thing): + """Return True if thing is a type or a generic type like thing.""" + return isinstance(thing, type) or isinstance(thing, typing_root_type) + + def from_typing_type(thing): # We start with special-case support for Union and Tuple - the latter # isn't actually a generic type. Support for Callable may be added to @@ -65,22 +76,32 @@ if not args: raise ResolutionFailed('Cannot resolve Union of no types.') return st.one_of([st.from_type(t) for t in args]) - if isinstance(thing, typing.TupleMeta): + if getattr(thing, '__origin__', None) == tuple or \ + isinstance(thing, getattr(typing, 'TupleMeta', ())): elem_types = getattr(thing, '__tuple_params__', None) or () elem_types += getattr(thing, '__args__', None) or () if getattr(thing, '__tuple_use_ellipsis__', False) or \ len(elem_types) == 2 and elem_types[-1] is Ellipsis: return st.lists(st.from_type(elem_types[0])).map(tuple) return st.tuples(*map(st.from_type, elem_types)) + if isinstance(thing, typing.TypeVar): + if getattr(thing, '__bound__', None) is not None: + return st.from_type(thing.__bound__) + if getattr(thing, '__constraints__', None): + return st.shared( + st.sampled_from(thing.__constraints__), + key='typevar-with-constraint' + ).flatmap(st.from_type) + # Constraints may be None or () on various Python versions. + return st.text() # An arbitrary type for the typevar # Now, confirm that we're dealing with a generic type as we expected - if not isinstance(thing, typing.GenericMeta): # pragma: no cover + if not isinstance(thing, typing_root_type): # pragma: no cover raise ResolutionFailed('Cannot resolve %s to a strategy' % (thing,)) # Parametrised generic types have their __origin__ attribute set to the # un-parametrised version, which we need to use in the subclass checks. # e.g.: typing.List[int].__origin__ == typing.List mapping = {k: v for k, v in _global_type_lookup.items() - if isinstance(k, typing.GenericMeta) and - try_issubclass(k, getattr(thing, '__origin__', None) or thing)} + if isinstance(k, typing_root_type) and try_issubclass(k, thing)} if typing.Dict in mapping: # The subtype relationships between generic and concrete View types # are sometimes inconsistent under Python 3.5, so we pop them out to @@ -206,10 +227,10 @@ args = args[0].__args__ elif hasattr(args[0], '__union_params__'): # pragma: no cover args = args[0].__union_params__ - if isinstance(typing._ForwardRef, type): # pragma: no cover + if isinstance(ForwardRef, type): # pragma: no cover # Duplicate check from from_type here - only paying when needed. for a in args: - if type(a) == typing._ForwardRef: + if type(a) == ForwardRef: raise ResolutionFailed( 'thing=%s cannot be resolved. Upgrading to ' 'python>=3.6 may fix this problem via improvements ' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/src/hypothesis/strategies.py new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/src/hypothesis/strategies.py --- old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/src/hypothesis/strategies.py 2018-07-20 15:37:18.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/src/hypothesis/strategies.py 2018-07-23 04:11:59.000000000 +0200 @@ -38,7 +38,8 @@ from hypothesis.internal.cache import LRUReusedCache from hypothesis.searchstrategy import SearchStrategy, check_strategy from hypothesis.internal.compat import gcd, ceil, floor, hrange, \ - string_types, get_type_hints, getfullargspec, implements_iterator + string_types, get_type_hints, getfullargspec, typing_root_type, \ + implements_iterator from hypothesis.internal.floats import next_up, next_down, is_negative, \ float_to_int, int_to_float, count_between_floats from hypothesis.internal.charmap import as_general_categories @@ -1189,7 +1190,6 @@ from hypothesis.searchstrategy import types if typing is not None: # pragma: no branch - fr = typing._ForwardRef if not isinstance(thing, type): # At runtime, `typing.NewType` returns an identity function rather # than an actual type, but we can check that for a possible match @@ -1206,12 +1206,13 @@ return one_of([from_type(t) for t in args]) # We can't resolve forward references, and under Python 3.5 (only) # a forward reference is an instance of type. Hence, explicit check: - elif type(thing) == fr: # pragma: no cover + elif hasattr(typing, '_ForwardRef') and \ + type(thing) == typing._ForwardRef: # pragma: no cover raise ResolutionFailed( 'thing=%s cannot be resolved. Upgrading to python>=3.6 may ' 'fix this problem via improvements to the typing module.' % (thing,)) - if not isinstance(thing, type): + if not types.is_a_type(thing): raise InvalidArgument('thing=%s must be a type' % (thing,)) # Now that we know `thing` is a type, the first step is to check for an # explicitly registered strategy. This is the best (and hopefully most @@ -1232,7 +1233,7 @@ # because there are several special cases that don't play well with # subclass and instance checks. if typing is not None: # pragma: no branch - if isinstance(thing, typing.TypingMeta): + if isinstance(thing, typing_root_type): return types.from_typing_type(thing) # If it's not from the typing module, we get all registered types that are # a subclass of `thing` and are not themselves a subtype of any other such @@ -1241,7 +1242,7 @@ strategies = [ v if isinstance(v, SearchStrategy) else v(thing) for k, v in types._global_type_lookup.items() - if issubclass(k, thing) and sum( + if isinstance(k, type) and issubclass(k, thing) and sum( types.try_issubclass(k, typ) for typ in types._global_type_lookup ) == 1 ] @@ -2072,7 +2073,7 @@ # TODO: We would like to move this to the top level, but pending some major # refactoring it's hard to do without creating circular imports. from hypothesis.searchstrategy import types - if not isinstance(custom_type, type): + if not types.is_a_type(custom_type): raise InvalidArgument('custom_type=%r must be a type') elif not (isinstance(strategy, SearchStrategy) or callable(strategy)): raise InvalidArgument( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/src/hypothesis/version.py new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/src/hypothesis/version.py --- old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/src/hypothesis/version.py 2018-07-20 15:37:18.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/src/hypothesis/version.py 2018-07-23 04:11:59.000000000 +0200 @@ -17,5 +17,5 @@ from __future__ import division, print_function, absolute_import -__version_info__ = (3, 66, 4) +__version_info__ = (3, 66, 6) __version__ = '.'.join(map(str, __version_info__)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/tests/py3/test_asyncio.py new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/tests/py3/test_asyncio.py --- old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/tests/py3/test_asyncio.py 2018-07-20 15:37:18.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/tests/py3/test_asyncio.py 2018-07-23 04:11:59.000000000 +0200 @@ -55,6 +55,7 @@ raise error @given(st.text()) + @asyncio.coroutine def test_foo(self, x): assume(x) yield from asyncio.sleep(0.001) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/tests/py3/test_lookup.py new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/tests/py3/test_lookup.py --- old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/tests/py3/test_lookup.py 2018-07-20 15:37:18.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/tests/py3/test_lookup.py 2018-07-23 04:11:59.000000000 +0200 @@ -26,20 +26,24 @@ import pytest import hypothesis.strategies as st -from hypothesis import find, given, infer, assume +from hypothesis import HealthCheck, find, given, infer, assume, settings from hypothesis.errors import NoExamples, InvalidArgument, ResolutionFailed from hypothesis.strategies import from_type from hypothesis.searchstrategy import types -from hypothesis.internal.compat import integer_types, get_type_hints +from hypothesis.internal.compat import ForwardRef, integer_types, \ + get_type_hints, typing_root_type typing = pytest.importorskip('typing') sentinel = object() generics = sorted((t for t in types._global_type_lookup - if isinstance(t, typing.GenericMeta)), key=str) + if isinstance(t, typing_root_type)), key=str) @pytest.mark.parametrize('typ', generics) def test_resolve_typing_module(typ): + @settings(suppress_health_check=[ + HealthCheck.too_slow, HealthCheck.filter_too_much + ]) @given(from_type(typ)) def inner(ex): if typ in (typing.BinaryIO, typing.TextIO): @@ -49,6 +53,8 @@ assert ex == () elif isinstance(typ, typing._ProtocolMeta): pass + elif typ is typing.Type and not isinstance(typing.Type, type): + assert isinstance(ex, typing.TypeVar) else: try: assert isinstance(ex, typ) @@ -227,6 +233,21 @@ from_type(typ).example() [email protected]('var,expected', [ + (typing.TypeVar('V'), object), + (typing.TypeVar('V', bound=int), int), + (typing.TypeVar('V', int, str), (int, str)), +]) +@given(data=st.data()) +def test_typevar_type_is_consistent(data, var, expected): + strat = st.from_type(var) + v1 = data.draw(strat) + v2 = data.draw(strat) + assume(v1 != v2) # Values may vary, just not types + assert type(v1) == type(v2) + assert isinstance(v1, expected) + + def annotated_func(a: int, b: int=2, *, c: int, d: int=4): return a + b + c + d @@ -391,7 +412,7 @@ def test_cannot_resolve_bare_forward_reference(thing): with pytest.raises(InvalidArgument): t = thing['int'] - if type(getattr(t, '__args__', [None])[0]) != typing._ForwardRef: + if type(getattr(t, '__args__', [None])[0]) != ForwardRef: assert sys.version_info[:2] == (3, 5) pytest.xfail('python 3.5 typing module is really weird') st.from_type(t).example() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/tests/pytest/test_capture.py new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/tests/pytest/test_capture.py --- old/hypothesis-hypothesis-python-3.66.4/hypothesis-python/tests/pytest/test_capture.py 2018-07-20 15:37:18.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.6/hypothesis-python/tests/pytest/test_capture.py 2018-07-23 04:11:59.000000000 +0200 @@ -81,7 +81,8 @@ script, '--verbose', '--capture=no') out = '\n'.join(result.stdout.lines) assert 'test_emits_unicode' in out - assert escape_unicode_characters(hunichr(1001)) in out + assert hunichr(1001) in out or \ + escape_unicode_characters(hunichr(1001)) in out assert result.ret == 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.66.4/tooling/scripts/ensure-rustup.sh new/hypothesis-hypothesis-python-3.66.6/tooling/scripts/ensure-rustup.sh --- old/hypothesis-hypothesis-python-3.66.4/tooling/scripts/ensure-rustup.sh 2018-07-20 15:37:18.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.6/tooling/scripts/ensure-rustup.sh 2018-07-23 04:11:59.000000000 +0200 @@ -3,7 +3,7 @@ set -o errexit set -o nounset -if ! which rustup > /dev/null ; then +if ! command -v rustup > /dev/null ; then curl https://sh.rustup.rs -sSf | sh -s -- -y fi
