Skip to content

Commit 81be6d2

Browse files
committed
better tests
1 parent 8276c19 commit 81be6d2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Lib/test/test_external_inspection.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,10 +1745,16 @@ def busy():
17451745
pass
17461746
break
17471747

1748+
attempts = 10
17481749
try:
17491750
unwinder = RemoteUnwinder(p.pid, all_threads=True, cpu_time=True)
1750-
time.sleep(0.2) # Give a bit of time to let threads settle
1751-
traces = unwinder.get_stack_trace()
1751+
for _ in range(attempts):
1752+
traces = unwinder.get_stack_trace()
1753+
# Check if any thread is running
1754+
if any(thread_info.status == 0 for interpreter_info in traces
1755+
for thread_info in interpreter_info.threads):
1756+
break
1757+
time.sleep(0.5) # Give a bit of time to let threads settle
17521758
except PermissionError:
17531759
self.skipTest(
17541760
"Insufficient permissions to read the stack trace"

0 commit comments

Comments
 (0)