[tox]
envlist = py{37,py37,38,py38,39,py39,310,311,312}-{brief,full,cover,nocover,niche,custom}
toxworkdir={env:TOX_WORK_DIR:.tox}

[testenv]
deps =
    -r../requirements/test.txt
allowlist_externals =
    bash
passenv=
    HOME
    LC_ALL
    COVERAGE_FILE
    TOXENV
    # Allow CI builds (or user builds) to force coloured terminal output.
    PY_COLORS
setenv=
    brief: HYPOTHESIS_PROFILE=speedy
commands =
    full: bash scripts/basic-test.sh
    brief: python -bb -X dev -m pytest -n auto tests/cover/test_testdecorators.py {posargs}
    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:py310-pyjion]
deps =
    -r../requirements/test.txt
    # We'd like to pin this, but pip-compile has to run under Python 3.10 (+)
    # to do so and that's painful because other tools aren't compatible yet.
    # If it's mid-2022, try again, starting by updating ci_version to 3.10
    pyjion
commands =
    # TODO: restore `-n auto` https://github.com/tonybaloney/Pyjion/issues/456
    # TODO: re-enable in Actions main.yml once this actually works
    pyjion -m pytest tests/cover tests/pytest tests/nocover

[testenv:quality]
deps=
    -r../requirements/test.txt
commands=
    python -bb -X dev -m pytest tests/quality/ -n auto

# Note: when adding or removing tested Pandas versions, make sure to update the
# docs in numpy.rst too.  To see current download rates of each minor version:
# https://pepy.tech/project/pandas?versions=1.0.*&versions=1.1.*&versions=1.2.*&versions=1.3.*&versions=1.4.*&versions=1.5.*
[testenv:py39-pandas10]
deps =
    -r../requirements/test.txt
    pandas~=1.0.5
    numpy~=1.23.5
commands =
    python -bb -X dev -m pytest tests/pandas -n auto

[testenv:pandas11]
deps =
    -r../requirements/test.txt
    pandas~=1.1.5
commands =
    python -bb -X dev -m pytest tests/pandas -n auto

[testenv:pandas12]
deps =
    -r../requirements/test.txt
    pandas~=1.2.5
commands =
    python -bb -X dev -m pytest tests/pandas -n auto

[testenv:pandas13]
deps =
    -r../requirements/test.txt
    pandas~=1.3.5
commands =
    python -bb -X dev -m pytest tests/pandas -n auto

[testenv:pandas14]
deps =
    -r../requirements/test.txt
    pandas~=1.4.3
commands =
    python -bb -X dev -m pytest tests/pandas -n auto

[testenv:pandas15]
deps =
    -r../requirements/test.txt
    pandas~=1.5.0
commands =
    python -bb -X dev -m pytest tests/pandas -n auto
# Adding a new pandas?  See comment above!

[testenv:django32]
commands =
    pip install .[pytz]
    pip install django~=3.2.15
    python -bb -X dev -m tests.django.manage test tests.django

[testenv:django40]
commands =
    pip install django~=4.0.7
    python -bb -X dev -m tests.django.manage test tests.django

[testenv:django41]
commands =
    pip install django~=4.1.0
    python -bb -X dev -m tests.django.manage test tests.django

[testenv:py{37,38,39}-nose]
deps =
    nose
commands=
    nosetests tests/cover/test_testdecorators.py

[testenv:py{37,38,39}-pytest46]
deps =
    -r../requirements/test.txt
commands=
    pip install pytest==4.6.11 pytest-xdist==1.34
    python -bb -X dev -W'ignore:the imp module:DeprecationWarning' -m pytest tests/pytest tests/cover/test_testdecorators.py

[testenv:py{37,38,39}-pytest54]
deps =
    -r../requirements/test.txt
commands=
    pip install pytest==5.4.3 pytest-xdist
    python -bb -X dev -m pytest tests/pytest tests/cover/test_testdecorators.py

[testenv:pytest62]
deps =
    -r../requirements/test.txt
commands=
    pip install pytest==6.2.5 pytest-xdist
    python -bb -X dev -m pytest tests/pytest tests/cover/test_testdecorators.py

[testenv:pytest7]
deps =
    -r../requirements/test.txt
commands=
    pip install pytest==7.* pytest-xdist
    python -bb -X dev -m pytest tests/pytest tests/cover/test_testdecorators.py

[testenv:coverage]
deps =
    -r../requirements/coverage.txt
allowlist_externals =
    rm
setenv=
    PYTHONDEVMODE=1
    HYPOTHESIS_INTERNAL_COVERAGE=true
commands_pre =
    rm -f branch-check
    pip install .[zoneinfo]
    python -m coverage --version
    python -m coverage debug sys
    # Explicitly erase any old .coverage file so the report never sees it.
    python -m coverage erase
# Produce a coverage report even if the test suite fails.
# (The tox task will still count as failed.)
ignore_errors = true
commands =
    python -bb -X dev -m coverage run --rcfile=.coveragerc --source=hypothesis -m pytest -n0 --ff {posargs} \
        tests/cover tests/conjecture tests/datetime tests/numpy tests/pandas tests/lark tests/redis tests/dpcontracts tests/codemods tests/typing_extensions
    python -m coverage report -m --fail-under=100 --show-missing --skip-covered
    python scripts/validate_branch_check.py


[testenv:conjecture-coverage]
deps =
    -r../requirements/coverage.txt
setenv=
    PYTHONDEVMODE=1
    HYPOTHESIS_INTERNAL_COVERAGE=true
commands_pre =
    python -m coverage erase
ignore_errors = true
commands =
    python -bb -X dev -m coverage run --rcfile=.coveragerc --source=hypothesis.internal.conjecture -m pytest -n0 --strict-markers tests/conjecture
    python -m coverage report -m --fail-under=100 --show-missing --skip-covered


[testenv:examples3]
deps=
    -r../requirements/test.txt
commands=
    python -m pip install --editable examples/example_hypothesis_entrypoint
    python -bb -X dev -m pytest examples
