Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7c0c1e7

Browse files
authored
Use the pytest -q option for tidier ouput with multi-core CPUs (#9845)
Without this option, pytest can print out many lines of garbage if there are more than 8 parallel processes being used. This can result in test output being hard to read, and it also looks bad. Since many new CPUs have 6+ cores, and 16+ cores are not unusual, it's reasonable to use -q by default.
1 parent c179eb8 commit 7c0c1e7

4 files changed

Lines changed: 19 additions & 17 deletions

File tree

mypyc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Then install the dependencies:
7373

7474
Now you can run the tests:
7575

76-
$ pytest mypyc
76+
$ pytest -q mypyc
7777

7878
Look at the [issue tracker](https://github.com/mypyc/mypyc/issues)
7979
for things to work on. Please express your interest in working on an

mypyc/doc/dev-intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Most mypyc test cases are defined in the same format (`.test`) as used
199199
for test cases for mypy. Look at mypy developer documentation for a
200200
general overview of how things work. Test cases live under
201201
`mypyc/test-data/`, and you can run all mypyc tests via `pytest
202-
mypyc`. If you don't make changes to code under `mypy/`, it's not
202+
-q mypyc`. If you don't make changes to code under `mypy/`, it's not
203203
important to regularly run mypy tests during development.
204204

205205
When you create a PR, we have Continuous Integration jobs set up that

runtests.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@
5959
# Lint
6060
'lint': 'flake8 -j0',
6161
# Fast test cases only (this is the bulk of the test suite)
62-
'pytest-fast': 'pytest -k "not (%s)"' % ' or '.join(ALL_NON_FAST),
62+
'pytest-fast': 'pytest -q -k "not (%s)"' % ' or '.join(ALL_NON_FAST),
6363
# Test cases that invoke mypy (with small inputs)
64-
'pytest-cmdline': 'pytest -k "%s"' % ' or '.join([CMDLINE,
65-
EVALUATION,
66-
STUBGEN_CMD,
67-
STUBGEN_PY]),
64+
'pytest-cmdline': 'pytest -q -k "%s"' % ' or '.join([CMDLINE,
65+
EVALUATION,
66+
STUBGEN_CMD,
67+
STUBGEN_PY]),
6868
# Test cases that may take seconds to run each
69-
'pytest-slow': 'pytest -k "%s"' % ' or '.join(
69+
'pytest-slow': 'pytest -q -k "%s"' % ' or '.join(
7070
[SAMPLES,
7171
TYPESHED,
7272
PEP561,
@@ -75,10 +75,10 @@
7575
MYPYC_COMMAND_LINE,
7676
ERROR_STREAM]),
7777
# Test cases to run in typeshed CI
78-
'typeshed-ci': 'pytest -k "%s"' % ' or '.join([CMDLINE, EVALUATION, SAMPLES, TYPESHED]),
78+
'typeshed-ci': 'pytest -q -k "%s"' % ' or '.join([CMDLINE, EVALUATION, SAMPLES, TYPESHED]),
7979
# Mypyc tests that aren't run by default, since they are slow and rarely
8080
# fail for commits that don't touch mypyc
81-
'mypyc-extra': 'pytest -k "%s"' % ' or '.join(MYPYC_OPT_IN),
81+
'mypyc-extra': 'pytest -q -k "%s"' % ' or '.join(MYPYC_OPT_IN),
8282
}
8383

8484
# Stop run immediately if these commands fail

test-data/unit/README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,34 +92,36 @@ module:
9292
The unit test suites are driven by the `pytest` framework. To run all mypy tests,
9393
run `pytest` in the mypy repository:
9494

95-
$ pytest mypy
95+
$ pytest -q mypy
9696

9797
This will run all tests, including integration and regression tests,
98-
and will verify that all stubs are valid. This may take several minutes to run,
99-
so you don't want to use this all the time while doing development.
98+
and will verify that all stubs are valid. This may take several
99+
minutes to run, so you don't want to use this all the time while doing
100+
development. (The `-q` option activates less verbose output that looks
101+
better when running tests using many CPU cores.)
100102

101103
Test suites for individual components are in the files `mypy/test/test*.py`.
102104

103105
Note that some tests will be disabled for older python versions.
104106

105107
If you work on mypyc, you will want to also run mypyc tests:
106108

107-
$ pytest mypyc
109+
$ pytest -q mypyc
108110

109111
You can run tests from a specific module directly, a specific suite within a
110112
module, or a test in a suite (even if it's data-driven):
111113

112-
$ pytest mypy/test/testdiff.py
114+
$ pytest -q mypy/test/testdiff.py
113115

114-
$ pytest mypy/test/testsemanal.py::SemAnalTypeInfoSuite
116+
$ pytest -q mypy/test/testsemanal.py::SemAnalTypeInfoSuite
115117

116118
$ pytest -n0 mypy/test/testargs.py::ArgSuite::test_coherence
117119

118120
$ pytest -n0 mypy/test/testcheck.py::TypeCheckSuite::testCallingVariableWithFunctionType
119121

120122
To control which tests are run and how, you can use the `-k` switch:
121123

122-
$ pytest -k "MethodCall"
124+
$ pytest -q -k "MethodCall"
123125

124126
You can also run the type checker for manual testing without
125127
installing it by setting up the Python module search path suitably:

0 commit comments

Comments
 (0)