https://github.com/python/cpython/commit/8d5f3cd2ce6b6af26d3882b8a21afba0a3f4c22f
commit: 8d5f3cd2ce6b6af26d3882b8a21afba0a3f4c22f
branch: main
author: Victor Stinner <vstin...@python.org>
committer: vstinner <vstin...@python.org>
date: 2025-05-05T12:38:51Z
summary:

gh-133419: fix test_external_inspection race assert (#133433)

Follow-up of commit c4cc5d58aee6a3be55a95efee6ec25d5774f7b5f,
fix more tests.

files:
M Lib/test/test_external_inspection.py

diff --git a/Lib/test/test_external_inspection.py 
b/Lib/test/test_external_inspection.py
index a2bce4781df015..ad3f669a03043e 100644
--- a/Lib/test/test_external_inspection.py
+++ b/Lib/test/test_external_inspection.py
@@ -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()
             """
@@ -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)
@@ -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",
                     [
@@ -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",
                             [
                                 [
@@ -234,7 +233,7 @@ def new_eager_loop():
                                             taskgroups.__file__,
                                             ANY,
                                         ),
-                                        ("main", script_name, 27),
+                                        ("main", script_name, 26),
                                     ],
                                     "Task-1",
                                     [],
@@ -242,7 +241,7 @@ def new_eager_loop():
                             ],
                         ],
                         [
-                            [("c1", script_name, 24)],
+                            [("c1", script_name, 23)],
                             "sub_main_2",
                             [
                                 [
@@ -257,7 +256,7 @@ def new_eager_loop():
                                             taskgroups.__file__,
                                             ANY,
                                         ),
-                                        ("main", script_name, 27),
+                                        ("main", script_name, 26),
                                     ],
                                     "Task-1",
                                     [],
@@ -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):
@@ -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",
                 [],
@@ -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)
@@ -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)
 
@@ -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(
@@ -490,8 +486,8 @@ 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",
@@ -499,7 +495,7 @@ async def main():
                     [
                         [
                             ("staggered_race", staggered.__file__, ANY),
-                            ("main", script_name, 22),
+                            ("main", script_name, 21),
                         ],
                         "Task-1",
                         [],

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to