From 7b3a0fc6b7fe935be008d2518eb480b75a8809d1 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Mon, 26 May 2025 19:28:02 +1000 Subject: 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 --- tests/cmdline/cmd_compile_only.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/cmdline/cmd_compile_only.py (limited to 'tests/cmdline/cmd_compile_only.py') diff --git a/tests/cmdline/cmd_compile_only.py b/tests/cmdline/cmd_compile_only.py new file mode 100644 index 000000000..89964c1b5 --- /dev/null +++ b/tests/cmdline/cmd_compile_only.py @@ -0,0 +1,13 @@ +# 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 -- cgit v1.2.3