]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[GH-133419] fix test_external_inspection race assert (#133422)
authorGregory P. Smith <greg@krypto.org>
Mon, 5 May 2025 04:41:22 +0000 (21:41 -0700)
committerGitHub <noreply@github.com>
Mon, 5 May 2025 04:41:22 +0000 (04:41 +0000)
[tests] fix test_external_inspection race assert

either line could be where the inspection finds the foo()
function as after ready is sent, the process may not have made progress
onto the next line yet.  "solve" by putting the statements on the same
line.

Lib/test/test_external_inspection.py

index 40c21c830c0436142b82adf0ce746358473ac50e..a2bce4781df0154accd195d64777917eab0db52c 100644 (file)
@@ -59,8 +59,7 @@ class TestGetStackTrace(unittest.TestCase):
                 foo()
 
             def foo():
-                sock.sendall(b"ready")
-                time.sleep(1000)
+                sock.sendall(b"ready"); time.sleep(1000)  # same line number
 
             bar()
             """
@@ -96,10 +95,10 @@ class TestGetStackTrace(unittest.TestCase):
                 p.wait(timeout=SHORT_TIMEOUT)
 
             expected_stack_trace = [
-                ("foo", script_name, 15),
+                ("foo", script_name, 14),
                 ("baz", script_name, 11),
                 ("bar", script_name, 9),
-                ("<module>", script_name, 17),
+                ("<module>", script_name, 16),
             ]
             self.assertEqual(stack_trace, expected_stack_trace)