Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mypyc] Add "runtests.py mypyc-fast" for running fast mypyc tests #17906

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mypyc/doc/dev-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ general overview of how things work. Test cases live under
-q mypyc`. If you don't make changes to code under `mypy/`, it's not
important to regularly run mypy tests during development.

You can use `python runtests.py mypyc-fast` to run a subset of mypyc
tests that covers most functionality but runs significantly quicker
than the entire test suite.

When you create a PR, we have Continuous Integration jobs set up that
compile mypy using mypyc and run the mypy test suite using the
compiled mypy. This will sometimes catch additional issues not caught
Expand Down
11 changes: 9 additions & 2 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
MYPYC_RUN_MULTI = "TestRunMultiFile"
MYPYC_EXTERNAL = "TestExternal"
MYPYC_COMMAND_LINE = "TestCommandLine"
MYPYC_SEPARATE = "TestRunSeparate"
MYPYC_MULTIMODULE = "multimodule" # Subset of mypyc run tests that are slow
ERROR_STREAM = "ErrorStreamSuite"


Expand All @@ -31,6 +33,7 @@
MYPYC_RUN_MULTI,
MYPYC_EXTERNAL,
MYPYC_COMMAND_LINE,
MYPYC_SEPARATE,
ERROR_STREAM,
]

Expand All @@ -40,7 +43,10 @@


# These must be enabled by explicitly including 'mypyc-extra' on the command line.
MYPYC_OPT_IN = [MYPYC_RUN, MYPYC_RUN_MULTI]
MYPYC_OPT_IN = [MYPYC_RUN, MYPYC_RUN_MULTI, MYPYC_SEPARATE]

# These mypyc test filters cover most slow test cases
MYPYC_SLOW = [MYPYC_RUN_MULTI, MYPYC_COMMAND_LINE, MYPYC_SEPARATE, MYPYC_MULTIMODULE]


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

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

assert all(cmd in cmds for cmd in FAST_FAIL)
Expand Down
Loading