summaryrefslogtreecommitdiff
path: root/tests/micropython
diff options
context:
space:
mode:
Diffstat (limited to 'tests/micropython')
-rw-r--r--tests/micropython/emg_exc.py16
-rw-r--r--tests/micropython/emg_exc.py.exp5
2 files changed, 19 insertions, 2 deletions
diff --git a/tests/micropython/emg_exc.py b/tests/micropython/emg_exc.py
index d228e6faa..4a9fa18bc 100644
--- a/tests/micropython/emg_exc.py
+++ b/tests/micropython/emg_exc.py
@@ -2,6 +2,11 @@
import micropython
import sys
+try:
+ import uio
+except ImportError:
+ print("SKIP")
+ raise SystemExit
# some ports need to allocate heap for the emg exc
try:
@@ -14,7 +19,16 @@ def f():
try:
raise ValueError(1)
except ValueError as er:
- sys.print_exception(er)
+ exc = er
micropython.heap_unlock()
+ # print the exception
+ buf = uio.StringIO()
+ sys.print_exception(exc, buf)
+ for l in buf.getvalue().split("\n"):
+ if l.startswith(" File "):
+ print(l.split('"')[2])
+ else:
+ print(l)
+
f()
diff --git a/tests/micropython/emg_exc.py.exp b/tests/micropython/emg_exc.py.exp
index 82b10b5f5..fd2cfb272 100644
--- a/tests/micropython/emg_exc.py.exp
+++ b/tests/micropython/emg_exc.py.exp
@@ -1 +1,4 @@
-ValueError:
+Traceback (most recent call last):
+, line 20, in f
+ValueError: 1
+