shared/runtime/pyexec: Provide support for compile-only mode.

When `MICROPY_PYEXEC_COMPILE_ONLY` is enabled and the global
`mp_compile_only` is True, code is compiled but not executed.

Also add comprehensive tests for compile-only functionality covering both
successful compilation and syntax error detection.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
This commit is contained in:
Andrew Leech
2025-05-26 19:28:02 +10:00
committed by Damien George
parent 3b2b8dd538
commit 7b3a0fc6b7
6 changed files with 35 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ target-version = "py37"
[tool.ruff.lint]
exclude = [ # Ruff finds Python SyntaxError in these files
"tests/cmdline/cmd_compile_only_error.py",
"tests/cmdline/repl_autocomplete.py",
"tests/cmdline/repl_autocomplete_underscore.py",
"tests/cmdline/repl_autoindent.py",
@@ -69,4 +70,9 @@ mccabe.max-complexity = 40
# basics: needs careful attention before applying automatic formatting
# repl_: not real python files
# viper_args: uses f(*)
exclude = ["tests/basics/*.py", "tests/*/repl_*.py", "tests/micropython/viper_args.py"]
exclude = [
"tests/basics/*.py",
"tests/*/repl_*.py",
"tests/cmdline/cmd_compile_only_error.py",
"tests/micropython/viper_args.py",
]