|
| 1 | +[tox] |
| 2 | +requires = |
| 3 | + tox>=4 |
| 4 | +envlist = |
| 5 | + # Test using the system Python. |
| 6 | + test, |
| 7 | + # Run pre-commit on all files. |
| 8 | + lint, |
| 9 | + # Run pre-commit on all files, including stages that require manual fixes. |
| 10 | + lint-manual, |
| 11 | + # Typecheck all files. |
| 12 | + typecheck |
| 13 | + |
| 14 | +[testenv:test] |
| 15 | +description = run unit tests |
| 16 | +commands = |
| 17 | + python --version |
| 18 | + python setup.py test {posargs} |
| 19 | + |
| 20 | +[testenv:lint] |
| 21 | +description = run pre-commit |
| 22 | +deps = |
| 23 | + pre-commit |
| 24 | +commands = |
| 25 | + pre-commit run --all-files |
| 26 | + |
| 27 | +[testenv:lint-manual] |
| 28 | +description = run all pre-commit stages, including those that require manual fixes |
| 29 | +deps = |
| 30 | + pre-commit |
| 31 | +commands = |
| 32 | + pre-commit run --all-files --hook-stage manual |
| 33 | + |
| 34 | +[testenv:typecheck-mypy] |
| 35 | +description = run mypy and pyright to typecheck |
| 36 | +deps = |
| 37 | + mypy |
| 38 | + zstandard |
| 39 | + certifi; platform_system == "win32" or platform_system == "Darwin" |
| 40 | + typing_extensions |
| 41 | + pyopenssl>=17.2.0 |
| 42 | + requests<3.0.0 |
| 43 | + service_identity>=18.1.0 |
| 44 | + pymongocrypt>=1.6.0,<2.0.0 |
| 45 | + pymongo-auth-aws<2.0.0 |
| 46 | +commands = |
| 47 | + mypy --install-types --non-interactive bson gridfs tools pymongo |
| 48 | + 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/*.*" test |
| 49 | + mypy --install-types --non-interactive test/test_typing.py test/test_typing_strict.py |
| 50 | + |
| 51 | +[testenv:typecheck-pyright] |
| 52 | +description = run pyright to typecheck |
| 53 | +deps = |
| 54 | + mypy |
| 55 | + pyright==1.1.290 |
| 56 | +commands = |
| 57 | + pyright test/test_typing.py test/test_typing_strict.py |
| 58 | + |
| 59 | +[testenv:typecheck-pyright-strict] |
| 60 | +description = run pyright with strict mode to typecheck |
| 61 | +deps = |
| 62 | + {[testenv:typecheck-pyright]deps} |
| 63 | +allowlist_externals=echo |
| 64 | +commands = |
| 65 | + echo '{"strict": ["tests/test_typing_strict.py"]}' > pyrightconfig.json |
| 66 | + pyright test/test_typing_strict.py |
| 67 | + |
| 68 | +[testenv:typecheck] |
| 69 | +description = run mypy and pyright to typecheck |
| 70 | +deps = |
| 71 | + {[testenv:typecheck-mypy]deps} |
| 72 | + {[testenv:typecheck-pyright]deps} |
| 73 | +allowlist_externals=echo |
| 74 | +commands = |
| 75 | + {[testenv:typecheck-mypy]commands} |
| 76 | + {[testenv:typecheck-pyright]commands} |
| 77 | + {[testenv:typecheck-pyright-strict]commands} |
0 commit comments