Skip to content

Commit

Permalink
Minor tox.ini improvement: use base = mypy
Browse files Browse the repository at this point in the history
Declaring a `base` environment allows you to declare a parallel
environment to an existing one with some settings overridden. This
lets us avoid the generative environment listing syntax (slightly
obscure as a feature, not everyone knows about it) and having two
`commands` lists fully differentiated by a factor.

The config here is 100% equivalent to what we had before, but is
easier to read and understand for developers less immersed in tox.
  • Loading branch information
sirosen committed Dec 17, 2024
1 parent fa22c64 commit 2e68aff
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ deps = pre-commit
skip_install = true
commands = pre-commit run --all-files

[testenv:mypy{,-test}]
commands_pre =
deps =
-r requirements/py{py_dot_ver}/typing.txt
commands =
!test: mypy src/ {posargs}
test: mypy --show-error-codes --warn-unused-ignores tests/non-pytest/mypy-ignore-tests/
[testenv:mypy]
deps = -r requirements/py{py_dot_ver}/typing.txt
commands = mypy src/ {posargs}

[testenv:mypy-test]
base = mypy
commands = mypy --show-error-codes --warn-unused-ignores tests/non-pytest/mypy-ignore-tests/

[testenv:test-lazy-imports]
deps = -r requirements/py{py_dot_ver}/test.txt
Expand Down

0 comments on commit 2e68aff

Please sign in to comment.