mongo-python-driver/tox.ini
2023-11-02 12:46:40 -05:00

178 lines
4.3 KiB
INI

[tox]
requires =
tox>=4
envlist =
# Test using the system Python.
test,
# Test using the run-tests Evergreen script.
test-eg,
# Run pre-commit on all files.
lint,
# Run pre-commit on all files, including stages that require manual fixes.
lint-manual,
# Typecheck using mypy.
typecheck-mypy,
# Typecheck using pyright.
typecheck-pyright,
# Typecheck using pyright strict.
typecheck-pyright-strict,
# Typecheck all files.
typecheck,
# Build sphinx docs
doc,
# Test sphinx docs
doc-test,
# Linkcheck sphinx docs
linkcheck
# Check the sdist integrity.
manifest
labels = # Use labels and -m instead of -e so that tox -m <label> fails instantly if the label does not exist
test = test
test-eg = test-eg
lint = lint
lint-manual = lint-manual
typecheck-mypy = typecheck-mypy
typecheck-pyright = typecheck-pyright
typecheck-pyright-strict = typecheck-pyright-strict
typecheck = typecheck
doc = doc
doc-test = doc-test
linkcheck = linkcheck
test-mockupdb = test-mockupdb
aws-secrets = aws-secrets
manifest = manifest
[testenv:test]
description = run base set of unit tests with no extra functionality
extras =
test
allowlist_externals =
.evergreen/check-c-extensions.sh
commands =
python --version
.evergreen/check-c-extensions.sh
pytest -v --durations=5 --maxfail=10 {posargs}
[testenv:test-eg]
description = run tests using run-tests.sh Evergreen script
passenv = *
extras = test
deps =
setuptools
allowlist_externals =
bash
commands =
bash ./.evergreen/run-tests.sh {posargs}
[testenv:lint]
description = run pre-commit
deps =
pre-commit
commands =
pre-commit run --all-files
[testenv:lint-manual]
description = run all pre-commit stages, including those that require manual fixes
deps =
pre-commit
commands =
pre-commit run --all-files --hook-stage manual
[testenv:typecheck-mypy]
description = run mypy and pyright to typecheck
extras =
encryption
ocsp
zstd
aws
deps =
mypy==1.2.0
certifi; platform_system == "win32" or platform_system == "Darwin"
typing_extensions
commands =
mypy --install-types --non-interactive bson gridfs tools pymongo
mypy --install-types --non-interactive --config-file mypy_test.ini test
mypy --install-types --non-interactive test/test_typing.py test/test_typing_strict.py
[testenv:typecheck-pyright]
description = run pyright to typecheck
deps =
mypy==1.2.0
pyright==1.1.290
commands =
pyright test/test_typing.py test/test_typing_strict.py
[testenv:typecheck-pyright-strict]
description = run pyright with strict mode to typecheck
deps =
{[testenv:typecheck-pyright]deps}
allowlist_externals=echo
commands =
echo '{"strict": ["tests/test_typing_strict.py"]}' > pyrightconfig.json
pyright test/test_typing_strict.py
[testenv:typecheck]
description = run mypy and pyright to typecheck
extras =
{[testenv:typecheck-mypy]extras}
deps =
{[testenv:typecheck-mypy]deps}
{[testenv:typecheck-pyright]deps}
allowlist_externals=echo
commands =
python tools/ensure_future_annotations_import.py
{[testenv:typecheck-mypy]commands}
{[testenv:typecheck-pyright]commands}
{[testenv:typecheck-pyright-strict]commands}
[testenv:doc]
description = build sphinx docs
deps =
-rdoc/docs-requirements.txt
commands =
sphinx-build -E -W -b html doc ./doc/_build/html
[testenv:doc-test]
description = run sphinx doc tests
deps =
{[testenv:doc]deps}
pytz
commands =
sphinx-build -E -b doctest doc ./doc/_build/doctest
[testenv:linkcheck]
description = check links of sphinx docs
deps =
{[testenv:doc]deps}
commands =
sphinx-build -E -b linkcheck doc ./doc/_build/linkcheck
[testenv:test-mockupdb]
description = run mockupdb tests
deps =
{[testenv:test]deps}
https://github.com/ajdavis/mongo-mockup-db/archive/master.zip
extras =
{[testenv:test]extras}
passenv = *
allowlist_externals =
{[testenv:test]allowlist_externals}
commands =
{[testenv:test]commands} ./test/mockupdb
[testenv:manifest]
deps =
check-manifest
commands =
python -m check_manifest -v
[testenv:aws-secrets]
deps =
PyYAML
boto3
passenv = *
commands =
python {env:DRIVERS_TOOLS}/.evergreen/auth_aws/setup_secrets.py {posargs}