| 1 | #!/bin/bash |
| 2 | set -e -o xtrace |
| 3 | |
| 4 | HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 5 | cd "$HERE/.." |
| 6 | |
| 7 | python -c ' |
| 8 | import os |
| 9 | for k, v in sorted(dict(os.environ).items()): |
| 10 | print("%s=%s" % (k, v)) |
| 11 | ' |
| 12 | |
| 13 | pip install . |
| 14 | |
| 15 | |
| 16 | PYTEST="python -bb -X dev -m pytest -nauto --durations-min=1.0" |
| 17 | |
| 18 | # Run all the no-extra-dependency tests for this version (except slow nocover tests) |
| 19 | $PYTEST tests/cover tests/pytest |
| 20 | |
| 21 | # Run tests for each extra module while the requirements are installed |
| 22 | pip install ".[pytz, dateutil, zoneinfo]" |
| 23 | $PYTEST tests/datetime/ |
| 24 | pip uninstall -y pytz python-dateutil |
| 25 | |
| 26 | pip install ".[dpcontracts]" |
| 27 | $PYTEST tests/dpcontracts/ |
| 28 | pip uninstall -y dpcontracts |
| 29 | |
| 30 | # use pinned redis version instead of inheriting from fakeredis |
| 31 | pip install "$(grep '^redis==' ../requirements/coverage.txt)" |
| 32 | pip install "$(grep 'fakeredis==' ../requirements/coverage.txt)" |
| 33 | $PYTEST tests/redis/ |
| 34 | pip uninstall -y redis fakeredis |
| 35 | |
| 36 | pip install "$(grep 'typing-extensions==' ../requirements/coverage.txt)" |
| 37 | $PYTEST tests/typing_extensions/ |
| 38 | pip uninstall -y typing_extensions |
| 39 | |
| 40 | pip install ".[lark]" |
| 41 | pip install "$(grep -m 1 -oE 'lark>=([0-9.]+)' ../hypothesis-python/pyproject.toml | tr '>' =)" |
| 42 | $PYTEST -Wignore tests/lark/ |
| 43 | pip install "$(grep 'lark==' ../requirements/coverage.txt)" |
| 44 | $PYTEST tests/lark/ |
| 45 | pip uninstall -y lark |
| 46 | |
| 47 | if [ "$(python -c $'import platform, sys; print(sys.version_info.releaselevel == \'final\' and platform.python_implementation() not in ("PyPy", "GraalVM"))')" = "True" ] ; then |
| 48 | pip install ".[codemods,cli]" |
| 49 | $PYTEST tests/codemods/ |
| 50 | pip uninstall -y libcst click |
| 51 | |
| 52 | if [ "$(python -c 'import sys; print(sys.version_info[:2] == (3, 10))')" = "True" ] ; then |
| 53 | # Per NEP-29, this is the last version to support Python 3.10 |
| 54 | pip install numpy==2.2.6 |
| 55 | else |
| 56 | pip install "$(grep 'numpy==' ../requirements/coverage.txt)" |
| 57 | fi |
| 58 | |
| 59 | pip install "$(grep -E 'black(==| @)' ../requirements/coverage.txt)" |
| 60 | $PYTEST tests/ghostwriter/ |
| 61 | pip uninstall -y black numpy |
| 62 | fi |
| 63 | |
| 64 | if [ "$(python -c 'import sys; print(sys.version_info[:2] == (3, 10))')" = "False" ] ; then |
| 65 | exit 0 |
| 66 | fi |
| 67 | |
| 68 | $PYTEST tests/nocover/ |
| 69 | |
| 70 | # Run some tests without docstrings or assertions, to catch bugs |
| 71 | # like issue #822 in one of the test decorators. See also #1541. |
| 72 | PYTHONOPTIMIZE=2 $PYTEST \ |
| 73 | -W'ignore:assertions not in test modules or plugins will be ignored because assert statements are not executed by the underlying Python interpreter:pytest.PytestConfigWarning' \ |
| 74 | -W'ignore:Module already imported so cannot be rewritten:pytest.PytestAssertRewriteWarning' \ |
| 75 | tests/cover/test_testdecorators.py |
| 76 | |
| 77 | case "$(python -c 'import platform; print(platform.python_implementation())')" in |
| 78 | PyPy|GraalVM) |
| 79 | ;; |
| 80 | *) |
| 81 | pip install .[django] |
| 82 | HYPOTHESIS_DJANGO_USETZ=TRUE python -m tests.django.manage test tests.django |
| 83 | HYPOTHESIS_DJANGO_USETZ=FALSE python -m tests.django.manage test tests.django |
| 84 | pip uninstall -y django pytz |
| 85 | |
| 86 | pip install "$(grep 'numpy==' ../requirements/coverage.txt)" |
| 87 | $PYTEST tests/array_api |
| 88 | $PYTEST tests/numpy |
| 89 | |
| 90 | pip install "$(grep 'pandas==' ../requirements/coverage.txt)" |
| 91 | $PYTEST tests/pandas |
| 92 | esac |