mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 20:20:14 +01:00
tests/micropython/opt_level_lineno.py: Force test func to use bytecode.
So that the test can run the same on all targets when used with the native emitter. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -3,4 +3,15 @@ import micropython as micropython
|
||||
# check that level 3 doesn't store line numbers
|
||||
# the expected output is that any line is printed as "line 1"
|
||||
micropython.opt_level(3)
|
||||
exec("try:\n xyz\nexcept NameError as er:\n import sys\n sys.print_exception(er)")
|
||||
|
||||
# force bytecode emitter, because native emitter doesn't store line numbers
|
||||
exec("""
|
||||
@micropython.bytecode
|
||||
def f():
|
||||
try:
|
||||
xyz
|
||||
except NameError as er:
|
||||
import sys
|
||||
sys.print_exception(er)
|
||||
f()
|
||||
""")
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Traceback (most recent call last):
|
||||
File "<string>", line 1, in <module>
|
||||
File "<string>", line 1, in f
|
||||
NameError: name 'xyz' isn't defined
|
||||
|
||||
@@ -131,7 +131,6 @@ emitter_tests_to_skip = {
|
||||
"misc/print_exception.py",
|
||||
"micropython/emg_exc.py",
|
||||
"micropython/heapalloc_traceback.py",
|
||||
"micropython/opt_level_lineno.py",
|
||||
"thread/thread_exc2.py",
|
||||
# These require stack-allocated slice optimisation.
|
||||
"micropython/heapalloc_slice.py",
|
||||
|
||||
Reference in New Issue
Block a user