File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,10 +54,16 @@ python3 runtests.py
5454You can also use ` tox ` to run tests (` tox ` handles setting up the test environment for you):
5555```
5656tox -e py
57+
58+ # Or some specific python version:
59+ tox -e py39
60+
61+ # Or some specific command:
62+ tox -e lint
5763```
5864
5965Some useful commands for running specific tests include:
60- ```
66+ ``` bash
6167# Use mypy to check mypy's own code
6268python3 runtests.py self
6369# or equivalently:
Original file line number Diff line number Diff line change @@ -176,6 +176,10 @@ full builtins and library stubs instead of minimal ones. Run them using
176176Note that running more processes than logical cores is likely to
177177significantly decrease performance.
178178
179+ To run tests with coverage:
180+
181+ python3 -m pytest --durations 100 --cov mypy --cov-config setup.cfg --cov-report=term-missing:skip-covered --cov-report=html
182+
179183
180184Debugging
181185---------
Original file line number Diff line number Diff line change @@ -14,36 +14,9 @@ isolated_build = true
1414
1515[testenv]
1616description = run the test driver with {basepython}
17- setenv = cov: COVERAGE_FILE ={toxworkdir}/.coverage.{envname}
1817passenv = PYTEST_XDIST_WORKER_COUNT PROGRAMDATA PROGRAMFILES(X86)
1918deps = -rtest-requirements.txt
2019commands = python -m pytest --durations 100 {posargs}
21- cov: python -m pytest --durations 100 {posargs: --cov mypy --cov-config setup.cfg}
22-
23-
24- [testenv:coverage]
25- description = [run locally after tests]: combine coverage data and create report
26- deps =
27- coverage >= 4.5.1, < 5
28- diff_cover >= 1.0.5, <2
29- skip_install = True
30- passenv =
31- {[testenv]passenv}
32- DIFF_AGAINST
33- setenv = COVERAGE_FILE ={toxworkdir}/.coverage
34- commands =
35- coverage combine --rcfile setup.cfg
36- coverage report -m --rcfile setup.cfg
37- coverage xml -o {toxworkdir}/coverage.xml --rcfile setup.cfg
38- coverage html -d {toxworkdir}/htmlcov --rcfile setup.cfg
39- diff-cover --compare-branch {env:DIFF_AGAINST:origin/master} {toxworkdir}/coverage.xml
40- depends =
41- py36,
42- py37,
43- py38,
44- py39,
45- py310,
46- parallel_show_output = True
4720
4821[testenv:lint]
4922description = check the code style
You can’t perform that action at this time.
0 commit comments