Skip to content

Commit 74fe1d6

Browse files
committed
tests: Improve test coverage of py/profile.c.
Signed-off-by: Jeff Epler <jepler@gmail.com>
1 parent b344312 commit 74fe1d6

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

tests/misc/sys_settrace_cov.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import sys
2+
3+
try:
4+
sys.settrace
5+
except AttributeError:
6+
print("SKIP")
7+
raise SystemExit
8+
9+
if sys.version.startswith("3.12"):
10+
# There is a CPython change in settrace that is reverted in 3.13!
11+
print("WARNING: this test will fail when compared to CPython 3.12.x behaviour")
12+
13+
14+
def trace_tick_handler(frame, event, arg):
15+
print("FRAME", frame)
16+
print("LASTI", frame.f_lasti)
17+
return None
18+
19+
20+
def f():
21+
x = 3
22+
return x
23+
24+
25+
sys.settrace(trace_tick_handler)
26+
f()
27+
sys.settrace(None)

tests/misc/sys_settrace_cov.py.exp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FRAME <frame at 0x\[0-9a-f\]\+, file 'misc/sys_settrace_repr\.py', line \\d\+, code f>
2+
LASTI \\d\+

tests/run-tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ def run_script_on_remote_target(pyb, args, test_file, is_special):
353353
"micropython/meminfo.py",
354354
"basics/bytes_compare3.py",
355355
"basics/builtin_help.py",
356+
"misc/sys_settrace_repr.py",
356357
"thread/thread_exc2.py",
357358
"ports/esp32/partition_ota.py",
358359
)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy