mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Update tests for location tuple and opcode field
Frame location is now a 4-tuple (lineno, end_lineno, col_offset, end_col_offset). MockFrameInfo wraps locations in LocationInfo struct. Updates assertions throughout and adds opcode_utils coverage.
This commit is contained in:
parent
7ffe4cb39e
commit
8b423df632
6 changed files with 924 additions and 160 deletions
|
|
@ -34,7 +34,7 @@
|
|||
skip_if_not_supported,
|
||||
PROCESS_VM_READV_SUPPORTED,
|
||||
)
|
||||
from .mocks import MockFrameInfo, MockThreadInfo, MockInterpreterInfo
|
||||
from .mocks import MockFrameInfo, MockThreadInfo, MockInterpreterInfo, LocationInfo
|
||||
|
||||
# Duration for profiling tests - long enough for process to complete naturally
|
||||
PROFILING_TIMEOUT = str(int(SHORT_TIMEOUT))
|
||||
|
|
@ -301,10 +301,10 @@ def test_collapsed_stack_with_recursion(self):
|
|||
MockThreadInfo(
|
||||
1,
|
||||
[
|
||||
("factorial.py", 10, "factorial"),
|
||||
("factorial.py", 10, "factorial"), # recursive
|
||||
("factorial.py", 10, "factorial"), # deeper
|
||||
("main.py", 5, "main"),
|
||||
MockFrameInfo("factorial.py", 10, "factorial"),
|
||||
MockFrameInfo("factorial.py", 10, "factorial"), # recursive
|
||||
MockFrameInfo("factorial.py", 10, "factorial"), # deeper
|
||||
MockFrameInfo("main.py", 5, "main"),
|
||||
],
|
||||
)
|
||||
],
|
||||
|
|
@ -315,13 +315,9 @@ def test_collapsed_stack_with_recursion(self):
|
|||
MockThreadInfo(
|
||||
1,
|
||||
[
|
||||
("factorial.py", 10, "factorial"),
|
||||
(
|
||||
"factorial.py",
|
||||
10,
|
||||
"factorial",
|
||||
), # different depth
|
||||
("main.py", 5, "main"),
|
||||
MockFrameInfo("factorial.py", 10, "factorial"),
|
||||
MockFrameInfo("factorial.py", 10, "factorial"), # different depth
|
||||
MockFrameInfo("main.py", 5, "main"),
|
||||
],
|
||||
)
|
||||
],
|
||||
|
|
@ -385,7 +381,7 @@ def cpu_intensive_work():
|
|||
|
||||
def main_loop():
|
||||
"""Main test loop."""
|
||||
max_iterations = 200
|
||||
max_iterations = 1000
|
||||
|
||||
for iteration in range(max_iterations):
|
||||
if iteration % 2 == 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue