Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[tox]
requires =
tox>=4
envlist =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lack of specified Python versions here will cause tox to run using the default system interpreter.

# Test using the system Python.
test,
# Run pre-commit on all files.
lint,
# Run pre-commit on all files, including stages that require manual fixes.
lint-manual,
# Typecheck all files.
typecheck

[testenv:test]
description = run unit tests
commands =
python --version
python setup.py test {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
pre-commit run --all-files --hook-stage manual flake8
pre-commit run --all-files --hook-stage manual doc8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-commit run --all-files --hook-stage manual will run all the pre-commit checks in one command.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!


[testenv:typecheck]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this environment, we can call the individual ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended to replace needing an alias to run all of the typechecks in a single command.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it is possible then to compose this to use the deps and commands of the other envs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figured it out, fixed!

description = run mypy to typecheck
deps =
mypy
zstandard
certifi; platform_system == "win32" or platform_system == "Darwin"
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/*.*" test
mypy --install-types --non-interactive test/test_typing.py test/test_typing_strict.py