Files
micropython/tests/cmdline/cmd_compile_only.py
Andrew Leech 7b3a0fc6b7 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>
2025-11-22 00:06:58 +11:00

14 lines
208 B
Python

# cmdline: -X compile-only
# test compile-only functionality
print("This should not be printed")
x = 1 + 2
def hello():
return "world"
class TestClass:
def __init__(self):
self.value = 42