From 2fda65f12b72e17e3b44685d39497a724628f84c Mon Sep 17 00:00:00 2001 From: Jonathan Plasse <13716151+JonathanPlasse@users.noreply.github.com> Date: Sat, 23 Mar 2024 21:37:58 -0700 Subject: [PATCH] Test CrossHair backend in the CI --- .github/workflows/main.yml | 3 +++ hypothesis-python/tests/common/setup.py | 4 ++-- hypothesis-python/tox.ini | 15 +++++++++++++++ tooling/src/hypothesistooling/__main__.py | 7 +++++-- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c1716becc7..b126372768 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,6 +73,9 @@ jobs: - check-pandas13 - check-pandas12 - check-pandas11 + # - check-crosshair-cover + # - check-crosshair-nocover + # - check-crosshair-niche - check-py38-oldestnumpy fail-fast: false steps: diff --git a/hypothesis-python/tests/common/setup.py b/hypothesis-python/tests/common/setup.py index 18a635cdc1..80e6812986 100644 --- a/hypothesis-python/tests/common/setup.py +++ b/hypothesis-python/tests/common/setup.py @@ -61,7 +61,7 @@ def run(): settings.register_profile("debug", settings(verbosity=Verbosity.debug)) - settings.load_profile(os.getenv("HYPOTHESIS_PROFILE", "default")) - for backend in set(AVAILABLE_PROVIDERS) - {"hypothesis"}: settings.register_profile(backend, backend=backend) # e.g. "crosshair" + + settings.load_profile(os.getenv("HYPOTHESIS_PROFILE", "default")) diff --git a/hypothesis-python/tox.ini b/hypothesis-python/tox.ini index 131f99698a..2b8c5bf356 100644 --- a/hypothesis-python/tox.ini +++ b/hypothesis-python/tox.ini @@ -103,6 +103,21 @@ commands = python -bb -X dev -m pytest tests/pandas -n auto # Adding a new pandas? See comment above! +[testenv:crosshair-{cover,nocover,niche,custom}] +deps = + -r../requirements/test.txt + -e .[crosshair] +allowlist_externals = + bash +setenv= + HYPOTHESIS_PROFILE=crosshair +commands = + # invoke with `./build.sh check-crosshair-cover -- -x -Wignore` + cover: python -bb -X dev -m pytest -n auto tests/cover/ tests/pytest/ {posargs} + nocover: python -bb -X dev -m pytest -n auto tests/nocover/ {posargs} + niche: bash scripts/other-tests.sh + custom: python -bb -X dev -m pytest {posargs} + [testenv:django32] commands = pip install .[pytz] diff --git a/tooling/src/hypothesistooling/__main__.py b/tooling/src/hypothesistooling/__main__.py index 2944a1e5e6..08cd84bab6 100644 --- a/tooling/src/hypothesistooling/__main__.py +++ b/tooling/src/hypothesistooling/__main__.py @@ -481,9 +481,9 @@ def tox(*args): run_tox(*args) -def standard_tox_task(name, *args, py=ci_version): +def standard_tox_task(name, py=ci_version): TASKS["check-" + name] = python_tests( - lambda: run_tox(name, PYTHONS.get(py, py), *args) + lambda *args: run_tox(name, PYTHONS.get(py, py), *args) ) @@ -498,6 +498,9 @@ def standard_tox_task(name, *args, py=ci_version): for n in [11, 12, 13, 14, 15, 20]: standard_tox_task(f"pandas{n}") +for kind in ("cover", "nocover", "niche"): + standard_tox_task(f"crosshair-{kind}") + standard_tox_task("py38-oldestnumpy", py="3.8") standard_tox_task("coverage")