mongo-python-driver/tox.ini
2023-07-14 09:51:19 -05:00

158 lines
4.1 KiB
INI

[tox]
requires =
tox>=4
envlist =
# Test using the system Python.
test,
# Test the extra encryption functionality.
test-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,
# Test sphinx docs
doc-test,
# Linkcheck sphinx docs
linkcheck
labels = # Use labels and -m instead of -e so that tox -m <label> fails instantly if the label does not exist
test = test
test-encryption = test-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-test = doc-test
linkcheck = linkcheck
test-atlas = test-atlas
test-mockupdb = test-mockupdb
[testenv:test]
description = run base set of unit tests with no extra functionality
deps =
pytest>=7
commands =
python --version
pytest -v -rs {posargs}
[testenv:test-encryption]
description = run base unit tests with encryption enabled
deps = {[testenv:test]deps}
extras = encryption
commands =
python --version
pytest {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 --disable-error-code var-annotated --disable-error-code attr-defined --disable-error-code union-attr --disable-error-code assignment --disable-error-code no-redef --disable-error-code index --allow-redefinition --allow-untyped-globals --exclude "test/mypy_fails/*.*" --exclude "test/conftest.py" 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 =
{[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 -b html doc ./doc/_build/html
[testenv:doc-test]
description = run sphinx doc tests
deps =
{[testenv:doc]deps}
gevent
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-atlas]
description = run atlas connection tests
deps =
{[testenv:test]deps}
passenv = *
commands =
python -m pytest -v ./test/atlas/test_connection.py
[testenv:test-mockupdb]
description = run mockupdb tests
deps =
{[testenv:test]deps}
https://github.com/ajdavis/mongo-mockup-db/archive/master.zip
passenv = *
commands =
python -m pytest -v ./test/mockupdb