Skip to content

Commit

Permalink
Make type checking a seperate tox environment
Browse files Browse the repository at this point in the history
pypy fails on mypy.stubtest with "ModuleNotFoundError: No module named
'_symtable'". The simplest way to to not run this on pypy is to split
out type checking into a seperate environment and only run it if not
pypy.

In doing so, the encoding warning need not be turned on for the type
checking environment so python does not need to be run in "ignore
warnings" mode to execute mypy.
  • Loading branch information
SethMMorton committed Dec 21, 2024
1 parent 4c009c3 commit 7083430
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ jobs:
run: python -m pip install tox
- name: Run
run: tox
- name: Run type checking
if: matrix.python != 'pypy3.10'
run: tox -e type

collateral:
strategy:
Expand Down
14 changes: 10 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
[testenv]
description = perform primary checks (tests, style, types, coverage)
description = perform primary checks (tests, style, coverage)
deps =
setenv =
PYTHONWARNDEFAULTENCODING = 1
commands =
pytest {posargs}
python -W ignore -m mypy path
python -W ignore -m mypy.stubtest path
usedevelop = True
extras =
test
check
cover
enabler
type

[testenv:diffcov]
description = run tests and check that diff from main is covered
Expand All @@ -35,6 +32,15 @@ commands =
python -m sphinx -W --keep-going . {toxinidir}/build/html
python -m sphinxlint

[testenv:type]
description = perform type checking
setenv =
extras =
type
commands =
python -m mypy path
python -m mypy.stubtest path

[testenv:finalize]
description = assemble changelog and tag a release
skip_install = True
Expand Down

0 comments on commit 7083430

Please sign in to comment.