summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/micropython/emg_exc.py16
-rw-r--r--tests/micropython/emg_exc.py.exp5
-rwxr-xr-xtests/run-tests1
3 files changed, 20 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
+
diff --git a/tests/run-tests b/tests/run-tests
index 866a9b7c3..568d99f8e 100755
--- a/tests/run-tests
+++ b/tests/run-tests
@@ -345,6 +345,7 @@ def run_tests(pyb, tests, args, base_path="."):
skip_tests.add('misc/rge_sm.py') # requires yield
skip_tests.add('misc/print_exception.py') # because native doesn't have proper traceback info
skip_tests.add('misc/sys_exc_info.py') # sys.exc_info() is not supported for native
+ skip_tests.add('micropython/emg_exc.py') # because native doesn't have proper traceback info
skip_tests.add('micropython/heapalloc_traceback.py') # because native doesn't have proper traceback info
skip_tests.add('micropython/heapalloc_iter.py') # requires generators
skip_tests.add('micropython/schedule.py') # native code doesn't check pending events