summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/misc/sys_settrace_cov.py23
-rw-r--r--tests/misc/sys_settrace_cov.py.exp2
-rw-r--r--tests/ports/unix/extra_coverage.py.exp4
-rwxr-xr-xtests/run-tests.py3
4 files changed, 29 insertions, 3 deletions
diff --git a/tests/misc/sys_settrace_cov.py b/tests/misc/sys_settrace_cov.py
new file mode 100644
index 0000000000..579c8a4a25
--- /dev/null
+++ b/tests/misc/sys_settrace_cov.py
@@ -0,0 +1,23 @@
+import sys
+
+try:
+ sys.settrace
+except AttributeError:
+ print("SKIP")
+ raise SystemExit
+
+
+def trace_tick_handler(frame, event, arg):
+ print("FRAME", frame)
+ print("LASTI", frame.f_lasti)
+ return None
+
+
+def f():
+ x = 3
+ return x
+
+
+sys.settrace(trace_tick_handler)
+f()
+sys.settrace(None)
diff --git a/tests/misc/sys_settrace_cov.py.exp b/tests/misc/sys_settrace_cov.py.exp
new file mode 100644
index 0000000000..423d78ec42
--- /dev/null
+++ b/tests/misc/sys_settrace_cov.py.exp
@@ -0,0 +1,2 @@
+FRAME <frame at 0x\[0-9a-f\]\+, file '\.\*/sys_settrace_cov.py', line \\d\+, code f>
+LASTI \\d\+
diff --git a/tests/ports/unix/extra_coverage.py.exp b/tests/ports/unix/extra_coverage.py.exp
index ac64edde69..ed21ced242 100644
--- a/tests/ports/unix/extra_coverage.py.exp
+++ b/tests/ports/unix/extra_coverage.py.exp
@@ -69,8 +69,8 @@ argv atexit byteorder exc_info
executable exit getsizeof implementation
intern maxsize modules path
platform print_exception ps1
-ps2 stderr stdin stdout
-tracebacklimit version version_info
+ps2 settrace stderr stdin
+stdout tracebacklimit version version_info
ementation
# attrtuple
(start=1, stop=2, step=3)
diff --git a/tests/run-tests.py b/tests/run-tests.py
index e45122b10e..faf1d2e3b4 100755
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -16,7 +16,7 @@ import threading
import tempfile
# Maximum time to run a PC-based test, in seconds.
-TEST_TIMEOUT = 30
+TEST_TIMEOUT = float(os.environ.get('MICROPY_TEST_TIMEOUT', 30))
# See stackoverflow.com/questions/2632199: __file__ nor sys.argv[0]
# are guaranteed to always work, this one should though.
@@ -354,6 +354,7 @@ special_tests = [
"micropython/meminfo.py",
"basics/bytes_compare3.py",
"basics/builtin_help.py",
+ "misc/sys_settrace_cov.py",
"thread/thread_exc2.py",
"ports/esp32/partition_ota.py",
)