mongo-python-driver/tox.ini

216 lines
5.3 KiB
INI

[tox]
requires =
tox>=4
envlist =
# Test using the system Python.
test,
# Test using the run-tests Evergreen script.
test-eg,
# Set up encryption files and services.
setup-encryption,
# Tear down encryption files and services.
teardown-encryption,
# 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,
# Server live sphinx docs
doc-serve,
# 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
setup-encryption = setup-encryption
teardown-encryption = teardown-encryption
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-serve = doc-serve
doc-test = doc-test
linkcheck = linkcheck
test-mockupdb = test-mockupdb
aws-secrets = aws-secrets
manifest = manifest
[testenv]
package = editable
[testenv:.pkg]
pass_env =
NO_EXT
[testenv:test]
description = run base set of unit tests with no extra functionality
extras =
test
commands =
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
skip_install = true
deps =
pre-commit
commands =
pre-commit run --all-files
[testenv:lint-manual]
description = run all pre-commit stages, including those that require manual fixes
skip_install = true
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 -W -b html doc ./doc/_build/html
[testenv:doc-serve]
description = serve sphinx docs
deps =
{[testenv:doc]deps}
sphinx-autobuild
commands =
sphinx-autobuild -W -b html doc --watch ./pymongo --watch ./bson --watch ./gridfs ./doc/_build/serve
[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]
description = ensure the sdist manifest is correct
skip_install = true
deps =
check-manifest
commands =
python -m check_manifest -v
[testenv:setup-encryption]
description = set up encryption assets and servers
skip_install = true
passenv = *
allowlist_externals =
bash
commands =
bash .evergreen/setup-libmongocrypt.sh
bash {env:DRIVERS_TOOLS}/.evergreen/csfle/setup-secrets.sh
bash {env:DRIVERS_TOOLS}/.evergreen/csfle/start-servers.sh
[testenv:teardown-encryption]
description = tear down encryption assets and servers
skip_install = true
passenv = *
allowlist_externals =
bash
rm
commands =
bash {env:DRIVERS_TOOLS}/.evergreen/csfle/stop-servers.sh
rm -rf libmongocrypt/ libmongocrypt_git/ libmongocrypt.tar.gz mongocryptd.pid