From 700efaab1ed5bfa44cc51b410095e05201dad9fc Mon Sep 17 00:00:00 2001 From: Zac Hatfield-Dodds Date: Mon, 16 Sep 2024 01:02:27 -0700 Subject: [PATCH 1/3] General test cleanups --- hypothesis-python/tests/cover/test_regex.py | 1 - .../tests/nocover/test_complex_numbers.py | 3 +-- .../tests/nocover/test_database_usage.py | 13 +++++++------ hypothesis-python/tests/numpy/test_from_dtype.py | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/hypothesis-python/tests/cover/test_regex.py b/hypothesis-python/tests/cover/test_regex.py index 5d9f9a2c56..c374f5af59 100644 --- a/hypothesis-python/tests/cover/test_regex.py +++ b/hypothesis-python/tests/cover/test_regex.py @@ -429,7 +429,6 @@ def test_fullmatch_generates_example(pattern, matching_str): find_any( st.from_regex(pattern, fullmatch=True), lambda s: s == matching_str, - settings(max_examples=10**6), ) diff --git a/hypothesis-python/tests/nocover/test_complex_numbers.py b/hypothesis-python/tests/nocover/test_complex_numbers.py index a66ae5e7fd..61315b7da7 100644 --- a/hypothesis-python/tests/nocover/test_complex_numbers.py +++ b/hypothesis-python/tests/nocover/test_complex_numbers.py @@ -10,13 +10,12 @@ import pytest -from hypothesis import given, settings, strategies as st +from hypothesis import given, strategies as st @pytest.mark.parametrize("width", [32, 64, 128]) @pytest.mark.parametrize("keyword", ["min_magnitude", "max_magnitude"]) @given(data=st.data()) -@settings(max_examples=1000) def test_magnitude_validates(width, keyword, data): # See https://github.com/HypothesisWorks/hypothesis/issues/3573 component_width = width / 2 diff --git a/hypothesis-python/tests/nocover/test_database_usage.py b/hypothesis-python/tests/nocover/test_database_usage.py index c755e2d579..1b8040b8dd 100644 --- a/hypothesis-python/tests/nocover/test_database_usage.py +++ b/hypothesis-python/tests/nocover/test_database_usage.py @@ -100,7 +100,6 @@ def condition(x): invalid.add(value) with deterministic_PRNG(): stuff() - assert len(all_values(database)) < original @@ -108,10 +107,11 @@ def test_respects_max_examples_in_database_usage(): key = b"a database key" database = InMemoryExampleDatabase() do_we_care = True - counter = [0] + counter = 0 def check(x): - counter[0] += 1 + nonlocal counter + counter += 1 return do_we_care and has_a_non_zero_byte(x) def stuff(): @@ -129,9 +129,10 @@ def stuff(): stuff() assert len(all_values(database)) > 10 do_we_care = False - counter[0] = 0 - stuff() - assert counter == [10] + counter = 0 + with deterministic_PRNG(): + stuff() + assert counter == 10 def test_does_not_use_database_when_seed_is_forced(monkeypatch): diff --git a/hypothesis-python/tests/numpy/test_from_dtype.py b/hypothesis-python/tests/numpy/test_from_dtype.py index 40e905cdc1..dacbe0af2c 100644 --- a/hypothesis-python/tests/numpy/test_from_dtype.py +++ b/hypothesis-python/tests/numpy/test_from_dtype.py @@ -69,7 +69,7 @@ def test_is_t(x): test_is_t() -@settings(max_examples=100) +@settings(max_examples=100, deadline=None) @given(nps.nested_dtypes(max_itemsize=400), st.data()) def test_infer_strategy_from_dtype(dtype, data): # Given a dtype From f81af9c6c072eb633e61ffa472417207fe9207d1 Mon Sep 17 00:00:00 2001 From: Zac Hatfield-Dodds Date: Mon, 16 Sep 2024 01:02:27 -0700 Subject: [PATCH 2/3] Update pinned deps --- build.sh | 4 +- hypothesis-python/setup.py | 2 +- hypothesis-python/tests/numpy/__init__.py | 2 +- requirements/coverage.in | 3 +- requirements/coverage.txt | 16 +++--- requirements/fuzzing.txt | 35 +++++++------ requirements/test.in | 1 + requirements/test.txt | 6 ++- requirements/tools.txt | 64 +++++++++++------------ tooling/src/hypothesistooling/__main__.py | 12 ++--- 10 files changed, 75 insertions(+), 70 deletions(-) diff --git a/build.sh b/build.sh index 2817f0dfc4..95dff72b10 100755 --- a/build.sh +++ b/build.sh @@ -25,8 +25,8 @@ if [ -n "${GITHUB_ACTIONS-}" ] || [ -n "${CODESPACES-}" ] ; then else # Otherwise, we install it from scratch # NOTE: tooling keeps this version in sync with ci_version in tooling - "$SCRIPTS/ensure-python.sh" 3.10.14 - PYTHON=$(pythonloc 3.10.14)/bin/python + "$SCRIPTS/ensure-python.sh" 3.10.15 + PYTHON=$(pythonloc 3.10.15)/bin/python fi TOOL_REQUIREMENTS="$ROOT/requirements/tools.txt" diff --git a/hypothesis-python/setup.py b/hypothesis-python/setup.py index b8e3f4a16e..48dc767564 100644 --- a/hypothesis-python/setup.py +++ b/hypothesis-python/setup.py @@ -60,7 +60,7 @@ def local_file(name): "pytest": ["pytest>=4.6"], "dpcontracts": ["dpcontracts>=0.4"], "redis": ["redis>=3.0.0"], - "crosshair": ["hypothesis-crosshair>=0.0.13", "crosshair-tool>=0.0.70"], + "crosshair": ["hypothesis-crosshair>=0.0.14", "crosshair-tool>=0.0.71"], # zoneinfo is an odd one: every dependency is conditional, because they're # only necessary on old versions of Python or Windows systems or emscripten. "zoneinfo": [ diff --git a/hypothesis-python/tests/numpy/__init__.py b/hypothesis-python/tests/numpy/__init__.py index ed352baedc..d1a16d93d7 100644 --- a/hypothesis-python/tests/numpy/__init__.py +++ b/hypothesis-python/tests/numpy/__init__.py @@ -17,5 +17,5 @@ import warnings with warnings.catch_warnings(): - warnings.simplefilter("ignore", EncodingWarning) + warnings.simplefilter("ignore", EncodingWarning) # noqa # not undefined import numpy.testing # noqa diff --git a/requirements/coverage.in b/requirements/coverage.in index 698196b4db..97abeec8d0 100644 --- a/requirements/coverage.in +++ b/requirements/coverage.in @@ -8,9 +8,8 @@ libcst numpy pandas pyarrow # Silence warning from Pandas >=2.2, <3 - see https://github.com/pandas-dev/pandas/issues/54466 +pytest-cov python-dateutil pytz typing-extensions -r test.in -# Need the unreleased compatibility fix for pytest-xdist rsyncdirs deprecation -git+https://github.com/pytest-dev/pytest-cov.git@9757222e2e044361e70125ebdd96e5eb87395983 diff --git a/requirements/coverage.txt b/requirements/coverage.txt index a06734da32..3081ac265e 100644 --- a/requirements/coverage.txt +++ b/requirements/coverage.txt @@ -9,7 +9,9 @@ annotated-types==0.7.0 async-timeout==4.0.3 # via redis attrs==24.1.0 - # via hypothesis (hypothesis-python/setup.py) + # via + # -r requirements/test.in + # hypothesis (hypothesis-python/setup.py) black==24.8.0 # via -r requirements/coverage.in click==8.1.7 @@ -26,7 +28,7 @@ exceptiongroup==1.2.2 ; python_version < "3.11" # pytest execnet==2.1.1 # via pytest-xdist -fakeredis==2.23.5 +fakeredis==2.24.1 # via -r requirements/coverage.in iniconfig==2.0.0 # via pytest @@ -36,7 +38,7 @@ libcst==1.4.0 # via -r requirements/coverage.in mypy-extensions==1.0.0 # via black -numpy==2.0.1 +numpy==2.1.1 # via # -r requirements/coverage.in # pandas @@ -51,7 +53,7 @@ pathspec==0.12.1 # via black pexpect==4.9.0 # via -r requirements/test.in -platformdirs==4.2.2 +platformdirs==4.3.3 # via black pluggy==1.5.0 # via pytest @@ -59,12 +61,12 @@ ptyprocess==0.7.0 # via pexpect pyarrow==17.0.0 # via -r requirements/coverage.in -pytest==8.3.2 +pytest==8.3.3 # via # -r requirements/test.in # pytest-cov # pytest-xdist -pytest-cov @ git+https://github.com/pytest-dev/pytest-cov.git@9757222e2e044361e70125ebdd96e5eb87395983 +pytest-cov==5.0.0 # via -r requirements/coverage.in pytest-xdist==3.6.1 # via -r requirements/test.in @@ -72,7 +74,7 @@ python-dateutil==2.9.0.post0 # via # -r requirements/coverage.in # pandas -pytz==2024.1 +pytz==2024.2 # via # -r requirements/coverage.in # pandas diff --git a/requirements/fuzzing.txt b/requirements/fuzzing.txt index c55df4c5b5..3fd4bc39c5 100644 --- a/requirements/fuzzing.txt +++ b/requirements/fuzzing.txt @@ -10,6 +10,7 @@ async-timeout==4.0.3 # via redis attrs==24.1.0 # via + # -r requirements/test.in # hypothesis # hypothesis (hypothesis-python/setup.py) black==24.8.0 @@ -19,7 +20,7 @@ black==24.8.0 # hypothesis blinker==1.8.2 # via flask -certifi==2024.7.4 +certifi==2024.8.30 # via requests charset-normalizer==3.3.2 # via requests @@ -33,7 +34,7 @@ coverage[toml]==7.6.1 # via # hypofuzz # pytest-cov -dash==2.17.1 +dash==2.18.1 # via hypofuzz dash-core-components==2.0.0 # via dash @@ -50,17 +51,17 @@ exceptiongroup==1.2.2 ; python_version < "3.11" # pytest execnet==2.1.1 # via pytest-xdist -fakeredis==2.23.5 +fakeredis==2.24.1 # via -r requirements/coverage.in flask==3.0.3 # via dash hypofuzz==24.2.3 # via -r requirements/fuzzing.in -hypothesis[cli]==6.111.1 +hypothesis[cli]==6.112.1 # via hypofuzz -idna==3.7 +idna==3.10 # via requests -importlib-metadata==8.2.0 +importlib-metadata==8.5.0 # via dash iniconfig==2.0.0 # via pytest @@ -86,7 +87,7 @@ mypy-extensions==1.0.0 # via black nest-asyncio==1.6.0 # via dash -numpy==2.0.1 +numpy==2.1.1 # via # -r requirements/coverage.in # pandas @@ -104,9 +105,9 @@ pathspec==0.12.1 # via black pexpect==4.9.0 # via -r requirements/test.in -platformdirs==4.2.2 +platformdirs==4.3.3 # via black -plotly==5.23.0 +plotly==5.24.1 # via dash pluggy==1.5.0 # via pytest @@ -118,13 +119,13 @@ pyarrow==17.0.0 # via -r requirements/coverage.in pygments==2.18.0 # via rich -pytest==8.3.2 +pytest==8.3.3 # via # -r requirements/test.in # hypofuzz # pytest-cov # pytest-xdist -pytest-cov @ git+https://github.com/pytest-dev/pytest-cov.git@9757222e2e044361e70125ebdd96e5eb87395983 +pytest-cov==5.0.0 # via -r requirements/coverage.in pytest-xdist==3.6.1 # via -r requirements/test.in @@ -132,7 +133,7 @@ python-dateutil==2.9.0.post0 # via # -r requirements/coverage.in # pandas -pytz==2024.1 +pytz==2024.2 # via # -r requirements/coverage.in # pandas @@ -146,7 +147,7 @@ requests==2.32.3 # hypofuzz retrying==1.3.4 # via dash -rich==13.7.1 +rich==13.8.1 # via hypothesis six==1.16.0 # via @@ -172,15 +173,15 @@ typing-extensions==4.12.2 # fakeredis tzdata==2024.1 # via pandas -urllib3==2.2.2 +urllib3==2.2.3 # via requests -werkzeug==3.0.3 +werkzeug==3.0.4 # via # dash # flask -zipp==3.20.0 +zipp==3.20.2 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: -setuptools==72.2.0 +setuptools==75.0.0 # via dash diff --git a/requirements/test.in b/requirements/test.in index 35899b0ba4..72e4385648 100644 --- a/requirements/test.in +++ b/requirements/test.in @@ -1,3 +1,4 @@ +attrs==24.1.0 # too early for https://github.com/python-attrs/attrs/pull/1329 pexpect pytest pytest-xdist diff --git a/requirements/test.txt b/requirements/test.txt index 6dc806376a..ea06393011 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -5,7 +5,9 @@ # ./build.sh upgrade-requirements # attrs==24.1.0 - # via hypothesis (hypothesis-python/setup.py) + # via + # -r requirements/test.in + # hypothesis (hypothesis-python/setup.py) exceptiongroup==1.2.2 ; python_version < "3.11" # via # hypothesis (hypothesis-python/setup.py) @@ -22,7 +24,7 @@ pluggy==1.5.0 # via pytest ptyprocess==0.7.0 # via pexpect -pytest==8.3.2 +pytest==8.3.3 # via # -r requirements/test.in # pytest-xdist diff --git a/requirements/tools.txt b/requirements/tools.txt index a5f6f38e4f..293851631a 100644 --- a/requirements/tools.txt +++ b/requirements/tools.txt @@ -12,7 +12,7 @@ asgiref==3.8.1 # via django asttokens==2.4.1 # via stack-data -attrs==24.1.0 +attrs==24.2.0 # via hypothesis (hypothesis-python/setup.py) autoflake==2.3.1 # via shed @@ -26,13 +26,13 @@ black==24.8.0 # via shed blinker==1.8.2 # via pelican -build==1.2.1 +build==1.2.2 # via pip-tools -cachetools==5.4.0 +cachetools==5.5.0 # via tox -certifi==2024.7.4 +certifi==2024.8.30 # via requests -cffi==1.17.0 +cffi==1.17.1 # via cryptography chardet==5.2.0 # via tox @@ -50,7 +50,7 @@ com2ann==0.3.0 # via shed coverage==7.6.1 # via -r requirements/tools.in -cryptography==43.0.0 +cryptography==43.0.1 # via # secretstorage # types-pyopenssl @@ -59,7 +59,7 @@ decorator==5.1.1 # via ipython distlib==0.3.8 # via virtualenv -django==5.1 +django==5.1.1 # via -r requirements/tools.in docutils==0.20.1 # via @@ -77,33 +77,33 @@ exceptiongroup==1.2.2 ; python_version < "3.11" # hypothesis (hypothesis-python/setup.py) # ipython # pytest -executing==2.0.1 +executing==2.1.0 # via stack-data feedgenerator==2.1.0 # via pelican -filelock==3.15.4 +filelock==3.16.0 # via # tox # virtualenv -idna==3.7 +idna==3.10 # via # anyio # requests imagesize==1.4.1 # via sphinx -importlib-metadata==8.2.0 +importlib-metadata==8.5.0 # via # keyring # twine iniconfig==2.0.0 # via pytest -ipython==8.26.0 +ipython==8.27.0 # via -r requirements/tools.in isort==5.13.2 # via shed jaraco-classes==3.4.0 # via keyring -jaraco-context==5.3.0 +jaraco-context==6.0.1 # via keyring jaraco-functools==4.0.2 # via keyring @@ -137,11 +137,11 @@ matplotlib-inline==0.1.7 # via ipython mdurl==0.1.2 # via markdown-it-py -more-itertools==10.4.0 +more-itertools==10.5.0 # via # jaraco-classes # jaraco-functools -mypy==1.11.1 +mypy==1.11.2 # via -r requirements/tools.in mypy-extensions==1.0.0 # via @@ -151,7 +151,7 @@ nh3==0.2.18 # via readme-renderer nodeenv==1.9.1 # via pyright -numpy==2.0.1 +numpy==2.1.1 # via -r requirements/tools.in ordered-set==4.1.0 # via pelican @@ -175,7 +175,7 @@ pip-tools==7.4.1 # via -r requirements/tools.in pkginfo==1.10.0 # via twine -platformdirs==4.2.2 +platformdirs==4.3.3 # via # black # tox @@ -207,15 +207,15 @@ pyproject-hooks==1.1.0 # via # build # pip-tools -pyright==1.1.376 +pyright==1.1.380 # via -r requirements/tools.in -pytest==8.3.2 +pytest==8.3.3 # via -r requirements/tools.in python-dateutil==2.9.0.post0 # via # -r requirements/tools.in # pelican -pytz==2024.1 +pytz==2024.2 # via feedgenerator pyupgrade==3.17.0 # via shed @@ -238,11 +238,11 @@ restructuredtext-lint==1.4.0 # via -r requirements/tools.in rfc3986==2.0.0 # via twine -rich==13.7.1 +rich==13.8.1 # via # pelican # twine -ruff==0.6.1 +ruff==0.6.5 # via -r requirements/tools.in secretstorage==3.3.3 # via keyring @@ -269,7 +269,7 @@ sphinx==7.4.7 # sphinxcontrib-jquery sphinx-codeautolink==0.15.2 # via -r requirements/tools.in -sphinx-hoverxref==1.4.0 +sphinx-hoverxref==1.4.1 # via -r requirements/tools.in sphinx-jsonschema==1.19.1 # via -r requirements/tools.in @@ -310,7 +310,7 @@ tomli==2.0.1 # pytest # sphinx # tox -tox==4.18.0 +tox==4.18.1 # via -r requirements/tools.in traitlets==5.14.3 # via @@ -324,11 +324,11 @@ types-click==7.1.8 # via -r requirements/tools.in types-pyopenssl==24.1.0.20240722 # via types-redis -types-pytz==2024.1.0.20240417 +types-pytz==2024.2.0.20240913 # via -r requirements/tools.in -types-redis==4.6.0.20240806 +types-redis==4.6.0.20240903 # via -r requirements/tools.in -types-setuptools==71.1.0.20240813 +types-setuptools==74.1.0.20240907 # via types-cffi typing-extensions==4.12.2 # via @@ -340,23 +340,23 @@ typing-extensions==4.12.2 # mypy unidecode==1.3.8 # via pelican -urllib3==2.2.2 +urllib3==2.2.3 # via # requests # twine -virtualenv==20.26.3 +virtualenv==20.26.4 # via tox -watchfiles==0.23.0 +watchfiles==0.24.0 # via pelican wcwidth==0.2.13 # via prompt-toolkit wheel==0.44.0 # via pip-tools -zipp==3.20.0 +zipp==3.20.2 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: pip==24.2 # via pip-tools -setuptools==72.2.0 +setuptools==75.0.0 # via pip-tools diff --git a/tooling/src/hypothesistooling/__main__.py b/tooling/src/hypothesistooling/__main__.py index e70fd4e0ac..c6ebe01554 100644 --- a/tooling/src/hypothesistooling/__main__.py +++ b/tooling/src/hypothesistooling/__main__.py @@ -446,18 +446,18 @@ def run_tox(task, version, *args): # When a version is added or removed, manually update the env lists in tox.ini and # workflows/main.yml, and the `Programming Language ::` specifiers in setup.py PYTHONS = { - "3.8": "3.8.19", - "3.9": "3.9.19", - "3.10": "3.10.14", - "3.11": "3.11.9", - "3.12": "3.12.5", + "3.8": "3.8.20", + "3.9": "3.9.20", + "3.10": "3.10.15", + "3.11": "3.11.10", + "3.12": "3.12.6", "3.13": "3.13.0rc2", "3.13t": "3.13t-dev", "3.14": "3.14-dev", "3.14t": "3.14t-dev", "pypy3.8": "pypy3.8-7.3.11", "pypy3.9": "pypy3.9-7.3.16", - "pypy3.10": "pypy3.10-7.3.16", + "pypy3.10": "pypy3.10-7.3.17", } ci_version = "3.10" # Keep this in sync with GH Actions main.yml and .readthedocs.yml From 1caa0f226ca157cfbdc61df7066155906cb7e993 Mon Sep 17 00:00:00 2001 From: Zac Hatfield-Dodds Date: Mon, 16 Sep 2024 02:22:55 -0700 Subject: [PATCH 3/3] drop win py39 CI --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1fa82dd360..709b232d90 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -150,7 +150,6 @@ jobs: strategy: matrix: python: - - version: "3.9" - version: "3.11" - version: "3.11" architecture: "x86"