Hello community, here is the log from the commit of package python-hypothesis for openSUSE:Factory checked in at 2018-07-13 10:17:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-hypothesis (Old) and /work/SRC/openSUSE:Factory/.python-hypothesis.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-hypothesis" Fri Jul 13 10:17:53 2018 rev:23 rq:622327 version:3.66.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-hypothesis/python-hypothesis.changes 2018-07-02 23:29:05.329573784 +0200 +++ /work/SRC/openSUSE:Factory/.python-hypothesis.new/python-hypothesis.changes 2018-07-13 10:17:55.834210845 +0200 @@ -1,0 +2,30 @@ +Thu Jul 12 15:59:06 UTC 2018 - [email protected] + +- update to version 3.66.1: + * This patch fixes a rare bug where an incorrect percentage drawtime + could be displayed for a test, when the system clock was changed + during a test running under Python 2 (we use time.monotonic() + where it is available to avoid such problems). It also fixes a + possible zero-division error that can occur when the underlying C + library double-rounds an intermediate value in math.fsum() and + gets the least significant bit wrong. + +------------------------------------------------------------------- +Sat Jul 7 17:11:59 UTC 2018 - [email protected] + +- update to version 3.66.0: + * This release improves validation of the alphabet argument to the + text() strategy. The following misuses are now deprecated, and + will be an error in a future version: + + passing an unordered collection (such as set('abc')), which + violates invariants about shrinking and reproducibility + + passing an alphabet sequence with elements that are not strings + + passing an alphabet sequence with elements that are not of + length one, which violates any size constraints that may apply + +------------------------------------------------------------------- +Fri Jul 6 11:58:50 UTC 2018 - [email protected] + +- remove redundant pythons buildrequire + +------------------------------------------------------------------- Old: ---- hypothesis-python-3.65.0.tar.gz New: ---- hypothesis-python-3.66.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-hypothesis.spec ++++++ --- /var/tmp/diff_new_pack.iVIaRg/_old 2018-07-13 10:17:56.338211443 +0200 +++ /var/tmp/diff_new_pack.iVIaRg/_new 2018-07-13 10:17:56.342211448 +0200 @@ -28,7 +28,7 @@ %endif %bcond_without python2 Name: python-hypothesis -Version: 3.65.0 +Version: 3.66.1 Release: 0 Summary: A library for property based testing License: MPL-2.0 @@ -48,7 +48,6 @@ BuildRequires: %{python_module mock} BuildRequires: %{python_module pytest >= 2.8.0} BuildRequires: %{python_module pytest-xdist >= 1.22.2} -BuildRequires: %{pythons} # /SECTION %if 0%{?suse_version} >= 1000 || 0%{?fedora_version} >= 24 Recommends: python-Django >= 1.11 ++++++ hypothesis-python-3.65.0.tar.gz -> hypothesis-python-3.66.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/.travis.yml new/hypothesis-hypothesis-python-3.66.1/.travis.yml --- old/hypothesis-hypothesis-python-3.65.0/.travis.yml 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/.travis.yml 2018-07-09 01:06:33.000000000 +0200 @@ -58,6 +58,9 @@ - env: TASK=check-py27-typing - env: TASK=check-py34 - env: TASK=check-py35 + - env: TASK=check-py37 + sudo: required + dist: xenial - env: TASK=check-nose - env: TASK=check-pytest28 - env: TASK=check-faker070 @@ -78,6 +81,10 @@ 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.65.0/CITATION new/hypothesis-hypothesis-python-3.66.1/CITATION --- old/hypothesis-hypothesis-python-3.65.0/CITATION 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/CITATION 2018-07-09 01:06:33.000000000 +0200 @@ -1,19 +1,19 @@ -Please use one of the following samples to cite the hypothesis version (change -x.y) from this installation +Please use one of the following samples to cite the hypothesis version +(change x.y to the version you are using) from this installation. Text: -[Hypothesis] Hypothesis x.y, 2016 -David R. MacIver, https://github.com/HypothesisWorks/hypothesis-python +[Hypothesis] Hypothesis x.y, 2018 +David R. MacIver, https://github.com/HypothesisWorks/hypothesis BibTeX: @misc{Hypothesisx.y, - title = {{H}ypothesis x.y}, - author = {David R. MacIver}, - year = {2016}, - howpublished = {\href{https://github.com/HypothesisWorks/hypothesis-python}{\texttt{https://github.com/HypothesisWorks/hypothesis-python}}}, + title = {{H}ypothesis x.y}, + author = {David R. MacIver}, + year = {2018}, + howpublished = {\href{https://github.com/HypothesisWorks/hypothesis}{\texttt{https://github.com/HypothesisWorks/hypothesis}}}, } -If you are unsure about which version of hypothesis you are using run: `pip show -hypothesis`. +If you are unsure about which version of Hypothesis you are using run: +`pip show hypothesis` for the Python version. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/docs/changes.rst new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/docs/changes.rst --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/docs/changes.rst 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/docs/changes.rst 2018-07-09 01:06:33.000000000 +0200 @@ -21,6 +21,74 @@ You should generally assume that an API is internal unless you have specific information to the contrary. +.. _v3.66.1: + +------------------- +3.66.1 - 2018-07-09 +------------------- + +This patch fixes a rare bug where an incorrect percentage drawtime +could be displayed for a test, when the system clock was changed during +a test running under Python 2 (we use :func:`python:time.monotonic` +where it is available to avoid such problems). It also fixes a possible +zero-division error that can occur when the underlying C library +double-rounds an intermediate value in :func:`python:math.fsum` and +gets the least significant bit wrong. + +.. _v3.66.0: + +------------------- +3.66.0 - 2018-07-05 +------------------- + +This release improves validation of the ``alphabet`` argument to the +:func:`~hypothesis.strategies.text` strategy. The following misuses +are now deprecated, and will be an error in a future version: + +- passing an unordered collection (such as ``set('abc')``), which + violates invariants about shrinking and reproducibility +- passing an alphabet sequence with elements that are not strings +- passing an alphabet sequence with elements that are not of length one, + which violates any size constraints that may apply + +Thanks to Sushobhit for adding these warnings (:issue:`1329`). + +.. _v3.65.3: + +------------------- +3.65.3 - 2018-07-04 +------------------- + +This release fixes a mostly theoretical bug where certain usage of the internal +API could trigger an assertion error inside Hypothesis. It is unlikely that +this problem is even possible to trigger through the public API. + +.. _v3.65.2: + +------------------- +3.65.2 - 2018-07-04 +------------------- + +This release fixes dependency information for coverage. Previously Hypothesis +would allow installing :pypi:`coverage` with any version, but it only works +with coverage 4.0 or later. + +We now specify the correct metadata in our ``setup.py``, so Hypothesis will +only allow installation with compatible versions of coverage. + +.. _v3.65.1: + +------------------- +3.65.1 - 2018-07-03 +------------------- + +This patch ensures that :doc:`stateful tests <stateful>` which raise an +error from a :pypi:`pytest` helper still print the sequence of steps +taken to reach that point (:issue:`1372`). This reporting was previously +broken because the helpers inherit directly from ``BaseException``, and +therefore require special handling to catch without breaking e.g. the use +of ctrl-C to quit the test. + .. _v3.65.0: ------------------- @@ -46,7 +114,7 @@ 3.64.1 - 2018-06-27 ------------------- -This patch fixes type-checking errors in our vendored prety-printer, +This patch fixes type-checking errors in our vendored pretty-printer, which were ignored by our mypy config but visible for anyone else (whoops). Thanks to Pi Delport for reporting :issue:`1359` so promptly. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/docs/community.rst new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/docs/community.rst --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/docs/community.rst 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/docs/community.rst 2018-07-09 01:06:33.000000000 +0200 @@ -13,5 +13,23 @@ Feel free to use these to ask for help, provide feedback, or discuss anything remotely Hypothesis related at all. -Please note that `the Hypothesis code of conduct <https://github.com/HypothesisWorks/hypothesis-python/blob/master/CODE_OF_CONDUCT.rst>`_ +Please note that `the Hypothesis code of conduct <https://github.com/HypothesisWorks/hypothesis/blob/master/CODE_OF_CONDUCT.rst>`_ applies in all Hypothesis community spaces. + +If you would like to cite Hypothesis, please consider `our sugested citation +<https://github.com/HypothesisWorks/hypothesis/blob/master/CITATION>`_. + +If you like repo badges, we suggest the following badge, which you can add +with reStructuredText or Markdown, respectively: + +.. image:: https://img.shields.io/badge/hypothesis-tested-brightgreen.svg + +.. code:: restructuredtext + + .. image:: https://img.shields.io/badge/hypothesis-tested-brightgreen.svg + :alt: Tested with Hypothesis + :target: https://hypothesis.readthedocs.io + +.. code:: md + + [](https://hypothesis.readthedocs.io/) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/docs/data.rst new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/docs/data.rst --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/docs/data.rst 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/docs/data.rst 2018-07-09 01:06:33.000000000 +0200 @@ -224,13 +224,24 @@ Composite strategies ~~~~~~~~~~~~~~~~~~~~ -The :func:`@composite <hypothesis.strategies.composite>` decorator lets you combine other strategies in more or less +The :func:`@composite <hypothesis.strategies.composite>` decorator lets +you combine other strategies in more or less arbitrary ways. It's probably the main thing you'll want to use for complicated custom strategies. -The composite decorator works by giving you a function as the first argument -that you can use to draw examples from other strategies. For example, the -following gives you a list and an index into it: +The composite decorator works by converting a function that returns one +example into a function that returns a strategy that produces such +examples - which you can pass to :func:`@given <hypothesis.given>`, modify +with ``.map`` or ``.filter``, and generally use like any other strategy. + +It does this by giving you a special function ``draw`` as the first +argument, which can be used just like the corresponding method of the +:func:`~hypothesis.strategies.data` strategy within a test. In fact, +the implementation is almost the same - but defining a strategy with +:func:`@composite <hypothesis.strategies.composite>` makes code reuse +easier, and usually improves the display of failing examples. + +For example, the following gives you a list and an index into it: .. doctest:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/docs/details.rst new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/docs/details.rst --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/docs/details.rst 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/docs/details.rst 2018-07-09 01:06:33.000000000 +0200 @@ -632,3 +632,30 @@ use it in any way outside of type hints. The only supported way to construct objects of this type is to use the functions provided by the :mod:`hypothesis.strategies` module! + + +.. _pytest-plugin: + +---------------------------- +The Hypothesis pytest Plugin +---------------------------- + +Hypothesis includes a tiny plugin to improve integration with :pypi:`pytest`, +which is activated by default (but does not affect other test runners). +It aims to improve the integration between Hypothesis and Pytest by +providing extra information and convenient access to config options. + +- ``pytest --hypothesis-show-statistics`` can be used to + :ref:`display test and data generation statistics <statistics>`. +- ``pytest --hypothesis-profile=<profile name>`` can be used to + :ref:`load a settings profile <settings_profiles>`. +- ``pytest --hypothesis-seed=<an int>`` can be used to + :ref:`reproduce a failure with a particular seed <reproducing-with-seed>`. + +Finally, all tests that are defined with Hypothesis automatically have +``@pytest.mark.hypothesis`` applied to them. See :ref:`here for information +on working with markers <pytest:mark examples>`. + +.. note:: + Pytest will load the plugin automatically if Hypothesis is installed. + You don't need to do anything at all to use it. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/docs/reproducing.rst new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/docs/reproducing.rst --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/docs/reproducing.rst 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/docs/reproducing.rst 2018-07-09 01:06:33.000000000 +0200 @@ -60,6 +60,8 @@ example if for some reason you really want to, but a single example must be consistent. +.. _reproducing-with-seed: + ------------------------------------- Reproducing a test run with ``@seed`` ------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/docs/stateful.rst new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/docs/stateful.rst --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/docs/stateful.rst 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/docs/stateful.rst 2018-07-09 01:06:33.000000000 +0200 @@ -179,6 +179,10 @@ Note that RuleBasedStateMachine must have at least one rule defined and that a single function cannot be used to define multiple rules (this to avoid having multiple rules doing the same things). +Due to the stateful execution method, rules generally cannot take arguments +from other sources such as fixtures or ``pytest.mark.parametrize`` - consider +providing them via a strategy such as :func:`~hypothesis.strategies.sampled_from` +instead. .. autofunction:: hypothesis.stateful.rule diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/scripts/basic-test.sh new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/scripts/basic-test.sh --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/scripts/basic-test.sh 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/scripts/basic-test.sh 2018-07-09 01:06:33.000000000 +0200 @@ -29,6 +29,11 @@ $PYTEST tests/datetime/ pip uninstall -y pytz python-dateutil +if [ "$(python -c 'import sys; print(sys.version_info[0] == 2)')" = "True" ] ; then + $PYTEST "tests/py2" +else + $PYTEST "tests/py3" +fi if [ "$DARWIN" = true ]; then exit 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/setup.py new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/setup.py --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/setup.py 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/setup.py 2018-07-09 01:06:33.000000000 +0200 @@ -68,7 +68,7 @@ extras['all'] = sorted(sum(extras.values(), [])) -install_requires = ['attrs>=16.0.0', 'coverage'] +install_requires = ['attrs>=16.0.0', 'coverage>=4.0'] # Using an environment marker on enum34 makes the dependency condition # independent of the build environemnt, which is important for wheels. # https://www.python.org/dev/peps/pep-0345/#environment-markers diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/src/hypothesis/core.py new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/src/hypothesis/core.py --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/src/hypothesis/core.py 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/src/hypothesis/core.py 2018-07-09 01:06:33.000000000 +0200 @@ -384,7 +384,25 @@ return tuple(sorted(exceptions, key=str)) -exceptions_to_reraise = skip_exceptions_to_reraise() +EXCEPTIONS_TO_RERAISE = skip_exceptions_to_reraise() + + +def failure_exceptions_to_catch(): + """Return a tuple of exceptions meaning 'this test has failed', to catch. + + This is intended to cover most common test runners; if you would + like another to be added please open an issue or pull request. + """ + exceptions = [Exception] + try: # pragma: no cover + from _pytest.outcomes import Failed + exceptions.append(Failed) + except ImportError: + pass + return tuple(exceptions) + + +EXCEPTIONS_TO_FAIL = failure_exceptions_to_catch() def new_given_argspec(original_argspec, generator_kwargs): @@ -692,7 +710,7 @@ except ( HypothesisDeprecationWarning, FailedHealthCheck, StopTest, - ) + exceptions_to_reraise: + ) + EXCEPTIONS_TO_RERAISE: raise except Exception as e: escalate_hypothesis_internal_error() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/src/hypothesis/internal/conjecture/engine.py new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/src/hypothesis/internal/conjecture/engine.py --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/src/hypothesis/internal/conjecture/engine.py 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/src/hypothesis/internal/conjecture/engine.py 2018-07-09 01:06:33.000000000 +0200 @@ -663,6 +663,17 @@ HealthCheck.large_base_example ) + # If the language starts with writes of length >= cap then there is + # only one string in it: Everything after cap is forced to be zero (or + # to be whatever value is written there). That means that once we've + # tried the zero value, there's nothing left for us to do, so we + # exit early here. + for i in hrange(self.cap): + if i not in zero_data.forced_indices: + break + else: + self.exit_with(ExitReason.finished) + self.health_check_state = HealthCheckState() count = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/src/hypothesis/stateful.py new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/src/hypothesis/stateful.py --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/src/hypothesis/stateful.py 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/src/hypothesis/stateful.py 2018-07-09 01:06:33.000000000 +0200 @@ -34,7 +34,7 @@ import attr import hypothesis.internal.conjecture.utils as cu -from hypothesis.core import find +from hypothesis.core import EXCEPTIONS_TO_FAIL, find from hypothesis.errors import Flaky, NoSuchExample, InvalidDefinition, \ HypothesisException from hypothesis.control import BuildContext @@ -77,7 +77,7 @@ return False except HypothesisException: raise - except Exception: + except EXCEPTIONS_TO_FAIL: verbose_report(traceback.format_exc) return True if settings is None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/src/hypothesis/statistics.py new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/src/hypothesis/statistics.py --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/src/hypothesis/statistics.py 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/src/hypothesis/statistics.py 2018-07-09 01:06:33.000000000 +0200 @@ -87,8 +87,15 @@ total_runtime = math.fsum(engine.all_runtimes) total_drawtime = math.fsum(engine.all_drawtimes) - if total_drawtime == 0.0: + if total_drawtime == 0.0 and total_runtime >= 0.0: self.draw_time_percentage = '~ 0%' + elif total_drawtime < 0.0 or total_runtime <= 0.0: + # This weird condition is possible in two ways: + # 1. drawtime and/or runtime are negative, due to clock changes + # on Python 2 or old OSs (we use monotonic() where available) + # 2. floating-point issues *very rarely* cause math.fsum to be + # off by the lowest bit, so drawtime==0 and runtime!=0, eek! + self.draw_time_percentage = 'NaN' else: draw_time_percentage = 100.0 * min( 1, total_drawtime / total_runtime) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/src/hypothesis/strategies.py new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/src/hypothesis/strategies.py --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/src/hypothesis/strategies.py 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/src/hypothesis/strategies.py 2018-07-09 01:06:33.000000000 +0200 @@ -28,6 +28,7 @@ from inspect import isclass, isfunction from fractions import Fraction from functools import reduce +from collections import Sequence import attr @@ -37,7 +38,7 @@ from hypothesis.internal.cache import LRUReusedCache from hypothesis.searchstrategy import SearchStrategy, check_strategy from hypothesis.internal.compat import gcd, ceil, floor, hrange, \ - text_type, get_type_hints, getfullargspec, implements_iterator + string_types, get_type_hints, getfullargspec, 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 @@ -926,7 +927,31 @@ elif isinstance(alphabet, SearchStrategy): char_strategy = alphabet else: - char_strategy = sampled_from(list(map(text_type, alphabet))) + if not isinstance(alphabet, Sequence): + note_deprecation( + 'alphabet must be an ordered sequence, or tests may be ' + 'flaky and shrinking weaker, but a %r is not a type of ' + 'sequence. This will be an error in future.' + % (type(alphabet),) + ) + alphabet = list(alphabet) + non_string = [c for c in alphabet if not isinstance(c, string_types)] + if non_string: + note_deprecation( + 'The following elements in alphabet are not unicode ' + 'strings, which will be an error in future: %r' + % (non_string,) + ) + alphabet = [str(c) for c in alphabet] + not_one_char = [c for c in alphabet + if isinstance(c, string_types) and len(c) != 1] + if not_one_char: + note_deprecation( + 'The following elements in alphabet are not of length ' + 'one, which leads to violation of size constraints and ' + 'will be an error in future: %r' % (not_one_char,) + ) + char_strategy = sampled_from(alphabet) return StringStrategy(lists( char_strategy, min_size=min_size, max_size=max_size )) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/src/hypothesis/version.py new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/src/hypothesis/version.py --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/src/hypothesis/version.py 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/src/hypothesis/version.py 2018-07-09 01:06:33.000000000 +0200 @@ -17,5 +17,5 @@ from __future__ import division, print_function, absolute_import -__version_info__ = (3, 65, 0) +__version_info__ = (3, 66, 1) __version__ = '.'.join(map(str, __version_info__)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tests/cover/test_conjecture_engine.py new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tests/cover/test_conjecture_engine.py --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tests/cover/test_conjecture_engine.py 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tests/cover/test_conjecture_engine.py 2018-07-09 01:06:33.000000000 +0200 @@ -36,7 +36,7 @@ ConjectureData from hypothesis.internal.conjecture.utils import calc_label_from_name from hypothesis.internal.conjecture.engine import Negated, Shrinker, \ - RunIsComplete, ConjectureRunner, universal + ExitReason, RunIsComplete, ConjectureRunner, universal SOME_LABEL = calc_label_from_name('some label') @@ -1313,3 +1313,20 @@ break data.mark_interesting() assert x == hbytes([0]) + + +def test_large_initial_write(): + big = hbytes(b'\xff') * 512 + + def f(data): + data.write(big) + data.draw_bits(63) + + with deterministic_PRNG(): + runner = ConjectureRunner(f, settings=settings( + max_examples=5000, buffer_size=1024, + database=None, suppress_health_check=HealthCheck.all(), + )) + runner.run() + + assert runner.exit_reason == ExitReason.finished diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tests/cover/test_simple_strings.py new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tests/cover/test_simple_strings.py --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tests/cover/test_simple_strings.py 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tests/cover/test_simple_strings.py 2018-07-09 01:06:33.000000000 +0200 @@ -23,6 +23,7 @@ import pytest from hypothesis import find, given, settings +from tests.common.utils import checks_deprecated_behaviour from hypothesis.strategies import text, binary, tuples, characters @@ -127,3 +128,18 @@ @given(text(max_size=10**6)) def test_can_set_max_size_large(s): pass + + +@checks_deprecated_behaviour +def test_alphabet_is_not_a_sequence(): + text(alphabet=set('abc')).example() + + +@checks_deprecated_behaviour +def test_alphabet_breaking_size_limit(): + text(['a', 'c', 'ed', 'b', 'abc']).example() + + +@checks_deprecated_behaviour +def test_alphabet_non_string(): + text([1, 2, 3]).example() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tests/cover/test_skipping.py new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tests/cover/test_skipping.py --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tests/cover/test_skipping.py 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tests/cover/test_skipping.py 2018-07-09 01:06:33.000000000 +0200 @@ -22,12 +22,12 @@ import pytest from hypothesis import given -from hypothesis.core import exceptions_to_reraise +from hypothesis.core import EXCEPTIONS_TO_RERAISE from tests.common.utils import capture_out from hypothesis.strategies import integers [email protected]('skip_exception', exceptions_to_reraise) [email protected]('skip_exception', EXCEPTIONS_TO_RERAISE) def test_no_falsifying_example_if_unittest_skip(skip_exception): """If a ``SkipTest`` exception is raised during a test, Hypothesis should not continue running the test and shrink process, nor should it print diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tests/cover/test_stateful.py new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tests/cover/test_stateful.py --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tests/cover/test_stateful.py 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tests/cover/test_stateful.py 2018-07-09 01:06:33.000000000 +0200 @@ -21,6 +21,7 @@ from collections import namedtuple, defaultdict import pytest +from _pytest.outcomes import Failed, Skipped from hypothesis import assume from hypothesis import settings as Settings @@ -958,3 +959,30 @@ targets=(), function=lambda self: 2, arguments={} ) assert len(Foo.initialize_rules()) == 2 + + +def test_steps_printed_despite_pytest_fail(capsys): + # Test for https://github.com/HypothesisWorks/hypothesis/issues/1372 + class RaisesProblem(RuleBasedStateMachine): + + @rule() + def oops(self): + pytest.fail() + + with pytest.raises(Failed): + run_state_machine_as_test(RaisesProblem) + out, _ = capsys.readouterr() + assert 'state = RaisesProblem()\nstate.oops()\nstate.teardown()\n' == out + + +def test_steps_not_printed_with_pytest_skip(capsys): + class RaisesProblem(RuleBasedStateMachine): + + @rule() + def skip_whole_test(self): + pytest.skip() + + with pytest.raises(Skipped): + run_state_machine_as_test(RaisesProblem) + out, _ = capsys.readouterr() + assert '' == out diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tests/cover/test_statistical_events.py new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tests/cover/test_statistical_events.py --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tests/cover/test_statistical_events.py 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tests/cover/test_statistical_events.py 2018-07-09 01:06:33.000000000 +0200 @@ -25,7 +25,10 @@ from hypothesis import HealthCheck, event, given, assume, example, settings from hypothesis import strategies as st -from hypothesis.statistics import collector +from hypothesis.statistics import Statistics, collector +from hypothesis.internal.conjecture.data import Status +from hypothesis.internal.conjecture.engine import ExitReason, \ + ConjectureRunner def call_for_statistics(test_function): @@ -193,3 +196,20 @@ stats = call_for_statistics(test) assert 'shrunk example' in stats.exit_reason + + [email protected]('drawtime,runtime', [ + (1, 0), (-1, 0), (0, -1), (-1, -1), +]) +def test_weird_drawtime_issues(drawtime, runtime): + # Regression test for #1346, where we don't have the expected relationship + # 0<=drawtime<= runtime due to changing clocks or floating-point issues. + engine = ConjectureRunner(lambda: None) + engine.exit_reason = ExitReason.finished + engine.status_runtimes[Status.VALID] = [0] + + engine.all_drawtimes.append(drawtime) + engine.all_runtimes.extend([0, runtime]) + + stats = Statistics(engine) + assert stats.draw_time_percentage == 'NaN' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tests/nocover/test_explore_arbitrary_languages.py new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tests/nocover/test_explore_arbitrary_languages.py --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tests/nocover/test_explore_arbitrary_languages.py 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tests/nocover/test_explore_arbitrary_languages.py 2018-07-09 01:06:33.000000000 +0200 @@ -23,13 +23,22 @@ import pytest import hypothesis.strategies as st -from hypothesis import Verbosity, HealthCheck, note, given, assume, \ - settings, unlimited +import hypothesis.internal.escalation as esc +from hypothesis import Phase, Verbosity, HealthCheck, note, given, \ + assume, settings, unlimited from hypothesis.internal.compat import hbytes from hypothesis.internal.conjecture.data import Status from hypothesis.internal.conjecture.engine import ConjectureRunner +def setup_module(module): + esc.PREVENT_ESCALATION = True + + +def teardown_module(module): + esc.PREVENT_ESCALATION = False + + @attr.s() class Write(object): value = attr.ib() @@ -95,7 +104,7 @@ runner = ConjectureRunner(test, settings=settings( max_examples=1, max_shrinks=100, buffer_size=512, database=None, suppress_health_check=HealthCheck.all(), - verbosity=Verbosity.quiet, + verbosity=Verbosity.quiet, phases=list(Phase), )) try: runner.run() @@ -107,8 +116,8 @@ @settings( max_examples=100, suppress_health_check=HealthCheck.all(), - deadline=None, verbosity=Verbosity.debug, timeout=unlimited, - use_coverage=False, + deadline=None, timeout=unlimited, + use_coverage=False, phases=set(Phase) - {Phase.shrink}, ) @given(st.data()) def test_explore_an_arbitrary_language(data): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tests/py3/test_annotations.py new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tests/py3/test_annotations.py --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tests/py3/test_annotations.py 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tests/py3/test_annotations.py 2018-07-09 01:06:33.000000000 +0200 @@ -17,6 +17,8 @@ from __future__ import division, print_function, absolute_import +import sys + import attr import pytest @@ -133,11 +135,15 @@ annot_converter = attr.ib(converter=a_converter) [email protected](sys.version_info[:2] <= (3, 5), + reason="Too-old typing module can't get return value hint") @given(st.builds(Inferrables)) def test_attrs_inference_builds(c): pass [email protected](sys.version_info[:2] <= (3, 5), + reason="Too-old typing module can't get return value hint") @given(st.from_type(Inferrables)) def test_attrs_inference_from_type(c): pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tox.ini new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tox.ini --- old/hypothesis-hypothesis-python-3.65.0/hypothesis-python/tox.ini 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/hypothesis-python/tox.ini 2018-07-09 01:06:33.000000000 +0200 @@ -1,5 +1,5 @@ [tox] -envlist = py{27,34,35,36,py27}-{brief,prettyquick,full,custom} +envlist = py{27,34,35,36,37,py27}-{brief,prettyquick,full,custom} toxworkdir={env:TOX_WORK_DIR:.tox} [testenv] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/requirements/coverage.txt new/hypothesis-hypothesis-python-3.66.1/requirements/coverage.txt --- old/hypothesis-hypothesis-python-3.65.0/requirements/coverage.txt 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/requirements/coverage.txt 2018-07-09 01:06:33.000000000 +0200 @@ -8,5 +8,5 @@ numpy==1.14.5 pandas==0.23.1 python-dateutil==2.7.3 # via pandas -pytz==2018.4 +pytz==2018.5 six==1.11.0 # via python-dateutil diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/requirements/test.txt new/hypothesis-hypothesis-python-3.66.1/requirements/test.txt --- old/hypothesis-hypothesis-python-3.65.0/requirements/test.txt 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/requirements/test.txt 2018-07-09 01:06:33.000000000 +0200 @@ -13,7 +13,7 @@ more-itertools==4.2.0 # via pytest pbr==4.0.4 # via mock pluggy==0.6.0 # via pytest -py==1.5.3 # via pytest +py==1.5.4 # via pytest pytest-forked==0.2 # via pytest-xdist pytest-xdist==1.22.2 pytest==3.6.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/requirements/tools.in new/hypothesis-hypothesis-python-3.66.1/requirements/tools.in --- old/hypothesis-hypothesis-python-3.65.0/requirements/tools.in 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/requirements/tools.in 2018-07-09 01:06:33.000000000 +0200 @@ -17,3 +17,7 @@ django numpy IPython + +prompt-toolkit==1.0.15 # via ipython==6.4.0 +pycodestyle==2.3.1 # via flake8==3.5.0 +pyflakes==1.6.0 # via flake8==3.5.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/requirements/tools.txt new/hypothesis-hypothesis-python-3.66.1/requirements/tools.txt --- old/hypothesis-hypothesis-python-3.65.0/requirements/tools.txt 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/requirements/tools.txt 2018-07-09 01:06:33.000000000 +0200 @@ -16,7 +16,7 @@ click==6.7 # via pip-tools, pyupio, safety coverage==4.5.1 decorator==4.3.0 # via ipython, traitlets -django==2.0.6 +django==2.0.7 docformatter==1.0 # via pyformat docutils==0.14 # via restructuredtext-lint, sphinx dparse==0.4.1 # via pyupio, safety @@ -29,7 +29,7 @@ ipython-genutils==0.2.0 # via traitlets ipython==6.4.0 isort==4.3.4 -jedi==0.12.0 # via ipython +jedi==0.12.1 # via ipython jinja2==2.10 # via pyupio, sphinx markupsafe==1.0 # via jinja2 mccabe==0.6.1 # via flake8 @@ -37,31 +37,31 @@ mypy==0.610 numpy==1.14.5 packaging==17.1 # via dparse, pyupio, safety, sphinx -parso==0.2.1 # via jedi +parso==0.3.0 # via jedi pexpect==4.6.0 # via ipython pickleshare==0.7.4 # via ipython pip-tools==2.0.2 pkginfo==1.4.2 # via twine pluggy==0.6.0 # via pytest, tox -prompt-toolkit==1.0.15 # via ipython +prompt-toolkit==1.0.15 ptyprocess==0.6.0 # via pexpect -py==1.5.3 # via pytest, tox -pycodestyle==2.3.1 # via autopep8, flake8 +py==1.5.4 # via pytest, tox +pycodestyle==2.3.1 pydocstyle==2.1.1 # via flake8-docstrings -pyflakes==1.6.0 # via autoflake, flake8 +pyflakes==1.6.0 pyformat==0.7 -pygithub==1.39 # via pyupio +pygithub==1.40 # via pyupio pygments==2.2.0 # via ipython, sphinx pyjwt==1.6.4 # via pygithub pyparsing==2.2.0 # via packaging pytest==3.6.2 python-dateutil==2.7.3 python-gitlab==1.5.1 # via pyupio -pytz==2018.4 # via babel, django +pytz==2018.5 # via babel, django pyupio==1.0.1 pyyaml==3.12 # via dparse, pyupio requests-toolbelt==0.8.0 # via twine -requests==2.19.1 # via python-gitlab, pyupio, requests-toolbelt, safety, sphinx, twine +requests==2.19.1 # via pygithub, python-gitlab, pyupio, requests-toolbelt, safety, sphinx, twine restructuredtext-lint==1.1.3 safety==1.8.1 # via pyupio simplegeneric==0.8.1 # via ipython diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/tooling/scripts/install-python.sh new/hypothesis-hypothesis-python-3.66.1/tooling/scripts/install-python.sh --- old/hypothesis-hypothesis-python-3.65.0/tooling/scripts/install-python.sh 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/tooling/scripts/install-python.sh 2018-07-09 01:06:33.000000000 +0200 @@ -100,6 +100,9 @@ 3.6) install 3.6.1 python3.6 ;; + 3.7) + install 3.7.0 python3.7 + ;; pypy) install pypy2.7-5.8.0 pypy ;; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hypothesis-hypothesis-python-3.65.0/tooling/src/hypothesistooling/__main__.py new/hypothesis-hypothesis-python-3.66.1/tooling/src/hypothesistooling/__main__.py --- old/hypothesis-hypothesis-python-3.65.0/tooling/src/hypothesistooling/__main__.py 2018-06-30 14:49:37.000000000 +0200 +++ new/hypothesis-hypothesis-python-3.66.1/tooling/src/hypothesistooling/__main__.py 2018-07-09 01:06:33.000000000 +0200 @@ -334,6 +334,7 @@ PY34 = '3.4.8' PY35 = '3.5.5' PY36 = '3.6.5' +PY37 = '3.7.0' PYPY2 = 'pypy2.7-5.10.0' @@ -347,12 +348,16 @@ PYPY2: 'pypy', } -for n in [PY27, PY34, PY35, PY36]: +for n in [PY27, PY34, PY35, PY36, PY37]: major, minor, patch = n.split('.') ALIASES[n] = 'python%s.%s' % (major, minor) -python_tests = task(if_changed=(hp.PYTHON_SRC, hp.PYTHON_TESTS)) +python_tests = task(if_changed=( + hp.PYTHON_SRC, + hp.PYTHON_TESTS, + os.path.join(hp.HYPOTHESIS_PYTHON, 'scripts'), +)) @python_tests @@ -376,6 +381,11 @@ @python_tests +def check_py37(): + run_tox('py37-full', PY37) + + +@python_tests def check_pypy(): run_tox('pypy-full', PYPY2)
