152 lines
3.8 KiB
INI
152 lines
3.8 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 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
|
|
lint = lint
|
|
lint-manual = lint-manual
|
|
linkcheck = linkcheck
|
|
manifest = manifest
|
|
typecheck-mypy = typecheck-mypy
|
|
|
|
[testenv]
|
|
passenv =
|
|
DB_IP
|
|
DB_PORT
|
|
DB_USER
|
|
DB_PASSWORD
|
|
CERT_DIR
|
|
ASYNC_TEST_TIMEOUT
|
|
FLE_AWS_KEY
|
|
FLE_AWS_SECRET
|
|
FLE_AZURE_CLIENTID
|
|
FLE_AZURE_TENANTID
|
|
FLE_AZURE_CLIENTSECRET
|
|
FLE_GCP_EMAIL
|
|
FLE_GCP_PRIVATEKEY
|
|
AIOHTTP_NO_EXTENSIONS
|
|
|
|
[testenv:test]
|
|
# TODO: Remove as part of MOTOR-1163
|
|
setenv = AIOHTTP_NO_EXTENSIONS=1
|
|
commands =
|
|
python --version
|
|
python -m pytest -v {posargs}
|
|
extras =
|
|
test
|
|
|
|
[testenv:docs]
|
|
setenv = PYTHONWARNINGS=
|
|
deps =
|
|
-rdoc/docs-requirements.txt
|
|
changedir = doc
|
|
commands =
|
|
python -m sphinx -q -E -W -b html . {envtmpdir}/html {posargs}
|
|
|
|
[testenv:doctest]
|
|
setenv = PYTHONHASHSEED=0
|
|
deps =
|
|
-rdoc/docs-requirements.txt
|
|
changedir = doc
|
|
commands =
|
|
python -m sphinx -q -E -b doctest . {envtmpdir}/doctest {posargs}
|
|
|
|
[testenv:linkcheck]
|
|
setenv = PYTHONHASHSEED=0
|
|
deps =
|
|
-rdoc/docs-requirements.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 --pre pymongocrypt
|
|
python --version
|
|
python -c "import pymongo; print('PyMongo %s' % (pymongo.version,))"
|
|
python -m pytest -v {posargs}
|
|
|
|
[testenv:synchro]
|
|
extras =
|
|
test
|
|
deps =
|
|
pynose
|
|
allowlist_externals =
|
|
git
|
|
setenv =
|
|
PYTHONPATH = {envtmpdir}/mongo-python-driver
|
|
# TODO: Remove as part of MOTOR-1163
|
|
AIOHTTP_NO_EXTENSIONS=1
|
|
commands =
|
|
git clone --depth 1 --branch master https://github.com/mongodb/mongo-python-driver.git {envtmpdir}/mongo-python-driver
|
|
python3 -m pip install -e {envtmpdir}/mongo-python-driver
|
|
python3 -m synchro.synchrotest --with-xunit --xunit-file=xunit-synchro-results -v -w {envtmpdir}/mongo-python-driver {posargs}
|
|
|
|
[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:manifest]
|
|
deps =
|
|
check-manifest
|
|
commands =
|
|
python -m check_manifest -v
|
|
|
|
[testenv:typecheck-mypy]
|
|
description = run mypy to typecheck
|
|
deps =
|
|
mypy==1.2.0
|
|
typing_extensions
|
|
setuptools==68.0.0
|
|
setenv = SKIP_ENV_SETUP=1
|
|
commands =
|
|
mypy --install-types --non-interactive motor/ --disallow-untyped-defs --follow-imports=skip --exclude 'motor/aiohttp/*' --exclude 'motor/frameworks/*' --exclude 'motor/metaprogramming.py' --exclude 'motor/web.py'
|
|
mypy --install-types --non-interactive --follow-imports=skip test/test_typing.py
|
|
python setup.py test -s test.test_mypy_fails
|