Skip to content

Commit cdbb4fc

Browse files
JukkaLgvanrossum
authored andcommitted
Updates to testing documentation and runtests.py help (#3971)
Fixed things that were out of date and de-emphasized myunit.
1 parent 6711a43 commit cdbb4fc

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

runtests.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,12 @@ def usage(status: int) -> None:
294294
print()
295295
print('Examples:')
296296
print(' %s unit-test (run unit tests only)' % sys.argv[0])
297-
print(' %s unit-test -a "*tuple*"' % sys.argv[0])
298-
print(' (run all unit tests with "tuple" in test name)')
297+
print(' %s testcheck (run type checking unit tests only)' % sys.argv[0])
298+
print(' %s "pytest unit-test" -a -k -a Tuple' % sys.argv[0])
299+
print(' (run all pytest unit tests with "Tuple" in test name)')
300+
print()
301+
print('You can also run pytest directly without using %s:' % sys.argv[0])
302+
print(' pytest mypy/test/testcheck.py -k Tuple')
299303
print()
300304
print('Options:')
301305
print(' -h, --help show this help')

test-data/unit/README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ To run all tests, run the script `runtests.py` in the mypy repository:
9393
Note that some tests will be disabled for older python versions.
9494

9595
This will run all tests, including integration and regression tests,
96-
and will type check mypy and verify that all stubs are valid.
96+
and will type check mypy and verify that all stubs are valid. This may
97+
take several minutes to run, so you don't want to use this all the time
98+
while doing development.
9799

98100
You can run a subset of test suites by passing positive or negative
99101
filters:
@@ -104,18 +106,23 @@ For example, to run unit tests only, which run pretty quickly:
104106

105107
$ ./runtests.py unit-test
106108

107-
The unit test suites are driven by a mixture of test frameworks: mypy's own
108-
`myunit` framework, and `pytest`, which we're in the process of migrating to.
109-
Test suites for individual components are in the files `mypy/test/test*.py`.
110-
You can run many of these individually by doing `runtests.py testfoobar`. For
111-
finer control over which unit tests are run and how, you can run `py.test` or
112-
`scripts/myunit` directly, or pass inferior arguments via `-a`:
109+
You can get a list of available test suites through the `-l` option
110+
(though this doesn't show all available subtasks):
111+
112+
$ ./runtests.py -l
113+
114+
The unit test suites are driven by a mixture of test frameworks: `pytest` and
115+
mypy's own `myunit` framework, which we're in the process of migrating away
116+
from. Test suites for individual components are in the files
117+
`mypy/test/test*.py`. You can run many of these individually by doing
118+
`runtests.py testfoobar`. For finer control over which unit tests are run and
119+
how, you can run `pytest` directly:
113120

114121
$ py.test mypy/test/testcheck.py -v -k MethodCall
115-
$ ./runtests.py -v 'pytest mypy/test/testcheck' -a -v -a -k -a MethodCall
116122

117-
$ PYTHONPATH=$PWD scripts/myunit -m mypy.test.testlex -v '*backslash*'
118-
$ ./runtests.py mypy.test.testlex -a -v -a '*backslash*'
123+
You can pass inferior arguments to pytest via `-a` when using `runtests.py`:
124+
125+
$ ./runtests.py pytest -a -v -a -k -a MethodCall
119126

120127
You can also run the type checker for manual testing without
121128
installing it by setting up the Python module search path suitably:
@@ -163,8 +170,7 @@ the number of processes to use. The default (set in `./pytest.ini`) is the
163170
number of logical cores; this can be overridden using `-n` option.
164171

165172
Note that running more processes than logical cores is likely to
166-
significantly decrease performance; the relevant count is the number of
167-
processes used by `runtests.py` plus those used by `pytest`.
173+
significantly decrease performance.
168174

169175

170176
Coverage reports

0 commit comments

Comments
 (0)