Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 23 additions & 27 deletions Lib/test/test_external_inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def baz():
foo()

def foo():
sock.sendall(b"ready"); time.sleep(1000) # same line number
sock.sendall(b"ready"); time.sleep(10_000) # same line number

bar()
"""
Expand Down Expand Up @@ -121,8 +121,7 @@ def test_async_remote_stack_trace(self):
sock.connect(('localhost', {port}))

def c5():
sock.sendall(b"ready")
time.sleep(10000)
sock.sendall(b"ready"); time.sleep(10_000) # same line number

async def c4():
await asyncio.sleep(0)
Expand Down Expand Up @@ -194,10 +193,10 @@ def new_eager_loop():
root_task = "Task-1"
expected_stack_trace = [
[
("c5", script_name, 11),
("c4", script_name, 15),
("c3", script_name, 18),
("c2", script_name, 21),
("c5", script_name, 10),
("c4", script_name, 14),
("c3", script_name, 17),
("c2", script_name, 20),
],
"c2_root",
[
Expand All @@ -213,13 +212,13 @@ def new_eager_loop():
taskgroups.__file__,
ANY,
),
("main", script_name, 27),
("main", script_name, 26),
],
"Task-1",
[],
],
[
[("c1", script_name, 24)],
[("c1", script_name, 23)],
"sub_main_1",
[
[
Expand All @@ -234,15 +233,15 @@ def new_eager_loop():
taskgroups.__file__,
ANY,
),
("main", script_name, 27),
("main", script_name, 26),
],
"Task-1",
[],
]
],
],
[
[("c1", script_name, 24)],
[("c1", script_name, 23)],
"sub_main_2",
[
[
Expand All @@ -257,7 +256,7 @@ def new_eager_loop():
taskgroups.__file__,
ANY,
),
("main", script_name, 27),
("main", script_name, 26),
],
"Task-1",
[],
Expand Down Expand Up @@ -287,8 +286,7 @@ def test_asyncgen_remote_stack_trace(self):
sock.connect(('localhost', {port}))

async def gen_nested_call():
sock.sendall(b"ready")
time.sleep(10000)
sock.sendall(b"ready"); time.sleep(10_000) # same line number

async def gen():
for num in range(2):
Expand Down Expand Up @@ -336,9 +334,9 @@ async def main():

expected_stack_trace = [
[
("gen_nested_call", script_name, 11),
("gen", script_name, 17),
("main", script_name, 20),
("gen_nested_call", script_name, 10),
("gen", script_name, 16),
("main", script_name, 19),
],
"Task-1",
[],
Expand All @@ -365,8 +363,7 @@ def test_async_gather_remote_stack_trace(self):

async def deep():
await asyncio.sleep(0)
sock.sendall(b"ready")
time.sleep(10000)
sock.sendall(b"ready"); time.sleep(10_000) # same line number

async def c1():
await asyncio.sleep(0)
Expand Down Expand Up @@ -413,9 +410,9 @@ async def main():
stack_trace[2].sort(key=lambda x: x[1])

expected_stack_trace = [
[("deep", script_name, ANY), ("c1", script_name, 16)],
[("deep", script_name, 11), ("c1", script_name, 15)],
"Task-2",
[[[("main", script_name, 22)], "Task-1", []]],
[[[("main", script_name, 21)], "Task-1", []]],
]
self.assertEqual(stack_trace, expected_stack_trace)

Expand All @@ -439,15 +436,14 @@ def test_async_staggered_race_remote_stack_trace(self):

async def deep():
await asyncio.sleep(0)
sock.sendall(b"ready")
time.sleep(10000)
sock.sendall(b"ready"); time.sleep(10_000) # same line number

async def c1():
await asyncio.sleep(0)
await deep()

async def c2():
await asyncio.sleep(10000)
await asyncio.sleep(10_000)

async def main():
await asyncio.staggered.staggered_race(
Expand Down Expand Up @@ -490,16 +486,16 @@ async def main():
stack_trace[2].sort(key=lambda x: x[1])
expected_stack_trace = [
[
("deep", script_name, ANY),
("c1", script_name, 16),
("deep", script_name, 11),
("c1", script_name, 15),
("staggered_race.<locals>.run_one_coro", staggered.__file__, ANY),
],
"Task-2",
[
[
[
("staggered_race", staggered.__file__, ANY),
("main", script_name, 22),
("main", script_name, 21),
],
"Task-1",
[],
Expand Down
Loading