motor/tox.ini
2024-06-07 08:23:48 -05:00

161 lines
3.9 KiB
INI

# Tox (https://tox.readthedocs.io) is a tool for running tests in multiple
# virtualenvs. "pip install tox>3.18" and run "tox" from this directory.
# Adapted from Tornado's tox.ini.
[tox]
requires =
tox>=4
envlist =
# Run the unit test suite
test
# Ensure the sphinx build has no errors or warnings.
docs,
# Run the doctests, include examples and tutorial, via Sphinx.
doctest,
# Check links of sphinx docs
linkcheck,
# Test with the latest PyMongo.
test-pymongo-latest,
# Apply PyMongo's test suite to Motor via Synchro.
synchro
# Run synchro tests with enterprise auth
enterprise-synchro
# Run pre-commit on all files.
lint
# Run pre-commit on all files with manual checks.
lint-manual
# Check the sdist integrity.
manifest
# Typecheck with mypy
typecheck-mypy
labels = # Use labels and -m instead of -e so that tox -m <label> fails instantly if the label does not exist
test = test
docs = docs
doctest = doctest
checklink = checklink
test-pymongo-latest = test-pymongo-latest
synchro = synchro
enterprise-synchro = enterprise-synchro
lint = lint
lint-manual = lint-manual
linkcheck = linkcheck
typecheck-mypy = typecheck-mypy
[testenv]
install_command =
python -I -m pip install --prefer-binary {opts} {packages}
passenv =
DB_IP
DB_PORT
DB_USER
DB_PASSWORD
CERT_DIR
ASYNC_TEST_TIMEOUT
FLE_AWS_KEY
FLE_AWS_SECRET
FLE_AWS_KEY2
FLE_AWS_SECRET2
FLE_AZURE_CLIENTID
FLE_AZURE_TENANTID
FLE_AZURE_CLIENTSECRET
FLE_GCP_EMAIL
FLE_GCP_PRIVATEKEY
[testenv:test]
commands =
python --version
python -m pytest -v {posargs}
extras =
test
[testenv:docs]
setenv = PYTHONWARNINGS=
deps =
-rrequirements/docs.txt
changedir = doc
commands =
python -m sphinx -q -E -W -b html . {envtmpdir}/html {posargs}
[testenv:doctest]
setenv = PYTHONHASHSEED=0
deps =
-rrequirements/docs.txt
changedir = doc
commands =
python -m sphinx -q -E -b doctest . {envtmpdir}/doctest {posargs}
[testenv:linkcheck]
setenv = PYTHONHASHSEED=0
deps =
-rrequirements/docs.txt
changedir = doc
commands =
python -m sphinx -q -E -b linkcheck . {envtmpdir}/linkcheck {posargs}
[testenv:test-pymongo-latest]
extras =
encryption
test
commands =
pip install git+https://github.com/mongodb/mongo-python-driver.git@master
pip install -q --pre --prefer-binary pymongocrypt
python --version
python -c "import pymongo; print('PyMongo %s' % (pymongo.version,))"
python -m pytest -v {posargs}
[testenv:synchro]
extras =
test
allowlist_externals =
git
setenv =
PYTHONPATH = {envtmpdir}/mongo-python-driver
commands =
git clone --depth 1 --branch master https://github.com/mongodb/mongo-python-driver.git {envtmpdir}/mongo-python-driver
python -m pip install -e {envtmpdir}/mongo-python-driver
python -m synchro.synchrotest {envtmpdir}/mongo-python-driver -v {posargs}
[testenv:enterprise-synchro]
extras =
test
gssapi
allowlist_externals =
git
passenv =
*
setenv =
PYTHONPATH = {envtmpdir}/mongo-python-driver
commands =
git clone --depth 1 --branch master https://github.com/mongodb/mongo-python-driver.git {envtmpdir}/mongo-python-driver
python -m pip install -e {envtmpdir}/mongo-python-driver
python -m synchro.synchrotest {envtmpdir}/mongo-python-driver -v test/test_auth.py
[testenv:lint]
deps =
pre-commit
commands =
python -m pre_commit run --all-files
[testenv:lint-manual]
deps =
pre-commit
commands =
python -m pre_commit run --all-files --hook-stage=manual
[testenv:typecheck-mypy]
description = run mypy to typecheck
extras =
test
deps =
mypy==1.7.0
setenv =
SKIP_ENV_SETUP=1
commands =
mypy --install-types --non-interactive motor
mypy --install-types --non-interactive test/test_typing.py
pytest test/test_mypy_fails.py