From 4a97f7aaf3c9123a7f127d6986b0f61ce9361beb Mon Sep 17 00:00:00 2001 From: David Lechner Date: Sat, 1 Feb 2020 21:10:42 -0600 Subject: [PATCH] tests/cmdline: Add test for MICROPYINSPECT environment variable. When this variable is set to non-empty string it triggers the REPL after a command/module/file finishes running. The Python file without the file extension is because the cmdline: parser in run-test splits on spaces, so we can't use the -c option since `import os` can't be written without a space. --- tests/cmdline/repl_micropyinspect | 3 +++ tests/cmdline/repl_micropyinspect.py | 2 ++ tests/cmdline/repl_micropyinspect.py.exp | 5 +++++ 3 files changed, 10 insertions(+) create mode 100644 tests/cmdline/repl_micropyinspect create mode 100644 tests/cmdline/repl_micropyinspect.py create mode 100644 tests/cmdline/repl_micropyinspect.py.exp diff --git a/tests/cmdline/repl_micropyinspect b/tests/cmdline/repl_micropyinspect new file mode 100644 index 0000000000..0710f1a75b --- /dev/null +++ b/tests/cmdline/repl_micropyinspect @@ -0,0 +1,3 @@ +import uos + +uos.putenv('MICROPYINSPECT', '1') diff --git a/tests/cmdline/repl_micropyinspect.py b/tests/cmdline/repl_micropyinspect.py new file mode 100644 index 0000000000..220dd43d80 --- /dev/null +++ b/tests/cmdline/repl_micropyinspect.py @@ -0,0 +1,2 @@ +# cmdline: cmdline/repl_micropyinspect +# setting MICROPYINSPECT environment variable before program exit triggers REPL diff --git a/tests/cmdline/repl_micropyinspect.py.exp b/tests/cmdline/repl_micropyinspect.py.exp new file mode 100644 index 0000000000..93ff43546e --- /dev/null +++ b/tests/cmdline/repl_micropyinspect.py.exp @@ -0,0 +1,5 @@ +MicroPython \.\+ version +Use \.\+ +>>> # cmdline: cmdline/repl_micropyinspect +>>> # setting MICROPYINSPECT environment variable before program exit triggers REPL +>>>