Skip to content

Commit 706a546

Browse files
authored
[mypyc] Add "runtests.py mypyc-fast" for running fast mypyc tests (#17906)
Many tests are a bit slow and but don't increase test coverage by a lot. Running these fast tests should find the vast majority of issues while being significantly faster than running all mypyc tests.
1 parent 62a971c commit 706a546

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

mypyc/doc/dev-intro.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ general overview of how things work. Test cases live under
202202
-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

205+
You can use `python runtests.py mypyc-fast` to run a subset of mypyc
206+
tests that covers most functionality but runs significantly quicker
207+
than the entire test suite.
208+
205209
When you create a PR, we have Continuous Integration jobs set up that
206210
compile mypy using mypyc and run the mypy test suite using the
207211
compiled mypy. This will sometimes catch additional issues not caught

runtests.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
MYPYC_RUN_MULTI = "TestRunMultiFile"
1818
MYPYC_EXTERNAL = "TestExternal"
1919
MYPYC_COMMAND_LINE = "TestCommandLine"
20+
MYPYC_SEPARATE = "TestRunSeparate"
21+
MYPYC_MULTIMODULE = "multimodule" # Subset of mypyc run tests that are slow
2022
ERROR_STREAM = "ErrorStreamSuite"
2123

2224

@@ -31,6 +33,7 @@
3133
MYPYC_RUN_MULTI,
3234
MYPYC_EXTERNAL,
3335
MYPYC_COMMAND_LINE,
36+
MYPYC_SEPARATE,
3437
ERROR_STREAM,
3538
]
3639

@@ -40,7 +43,10 @@
4043

4144

4245
# These must be enabled by explicitly including 'mypyc-extra' on the command line.
43-
MYPYC_OPT_IN = [MYPYC_RUN, MYPYC_RUN_MULTI]
46+
MYPYC_OPT_IN = [MYPYC_RUN, MYPYC_RUN_MULTI, MYPYC_SEPARATE]
47+
48+
# These mypyc test filters cover most slow test cases
49+
MYPYC_SLOW = [MYPYC_RUN_MULTI, MYPYC_COMMAND_LINE, MYPYC_SEPARATE, MYPYC_MULTIMODULE]
4450

4551

4652
# We split the pytest run into three parts to improve test
@@ -77,6 +83,7 @@
7783
"-k",
7884
" or ".join([DAEMON, MYPYC_EXTERNAL, MYPYC_COMMAND_LINE, ERROR_STREAM]),
7985
],
86+
"mypyc-fast": ["pytest", "-q", "mypyc", "-k", f"not ({' or '.join(MYPYC_SLOW)})"],
8087
# Test cases that might take minutes to run
8188
"pytest-extra": ["pytest", "-q", "-k", " or ".join(PYTEST_OPT_IN)],
8289
# Mypyc tests that aren't run by default, since they are slow and rarely
@@ -87,7 +94,7 @@
8794
# Stop run immediately if these commands fail
8895
FAST_FAIL = ["self", "lint"]
8996

90-
EXTRA_COMMANDS = ("pytest-extra", "mypyc-extra")
97+
EXTRA_COMMANDS = ("pytest-extra", "mypyc-fast", "mypyc-extra")
9198
DEFAULT_COMMANDS = [cmd for cmd in cmds if cmd not in EXTRA_COMMANDS]
9299

93100
assert all(cmd in cmds for cmd in FAST_FAIL)

0 commit comments

Comments
 (0)