1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
|
# 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,
# Test with oldest supported PyMongo.
test-pymongo-4.9,
# Test with other supported stable PyMongos.
test-pymongo-4.10,
test-pymongo-4.11,
# 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
test-pymongo-4.9 = test-pymongo-4.9
test-pymongo-4.10 = test-pymongo-4.10
test-pymongo-4.11 = test-pymongo-4.11
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 -W -E -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 https://github.com/mongodb/mongo-python-driver/archive/master.tar.gz
pip install -q --pre --prefer-binary pymongocrypt
python --version
python -c "import pymongo; print('PyMongo %s' % (pymongo.version,))"
python -m pytest -s -v {posargs}
[testenv:test-pymongo-4.9]
extras =
encryption
test
commands =
pip install pymongo==4.9
python -m pytest -v {posargs}
[testenv:test-pymongo-4.10]
extras =
encryption
test
commands =
pip install pymongo==4.10
python -m pytest -v {posargs}
[testenv:test-pymongo-4.11]
extras =
encryption
test
commands =
pip install pymongo==4.11
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 {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 {envtmpdir}/mongo-python-driver
python -m pip install -e {envtmpdir}/mongo-python-driver
python -m synchro.synchrotest {envtmpdir}/mongo-python-driver -m auth -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
python test/check_runtime_types.py
|