Skip to content

Commit 5c73077

Browse files
committed
Relax test task/thread checker.
1 parent 6b1ee62 commit 5c73077

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

test/conftest.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,24 @@ async def _check_system_health():
5050
yield
5151
await asyncio.sleep(0.1)
5252
all_clean = True
53-
error_text = "ERROR tasks/threads hanging:\n"
54-
for thread in thread_enumerate():
55-
name = thread.getName()
56-
if not (
57-
(name in start_threads)
58-
or (name == "asyncio_0")
59-
or (sys.version_info.minor == 8 and name.startswith("ThreadPoolExecutor"))
60-
):
61-
error_text += f"-->THREAD: {thread}\n"
62-
all_clean = False
63-
for task in asyncio.all_tasks():
64-
if not (task.get_name() in start_tasks or "wrap_asyncgen_fixture" in str(task)):
65-
error_text += f"-->TASK: {task}\n"
66-
all_clean = False
53+
for count in range(10):
54+
error_text = f"ERROR tasks/threads hanging after {count} retries:\n"
55+
for thread in thread_enumerate():
56+
name = thread.getName()
57+
if not (
58+
(name in start_threads)
59+
or (name == "asyncio_0")
60+
or (sys.version_info.minor == 8 and name.startswith("ThreadPoolExecutor"))
61+
):
62+
error_text += f"-->THREAD: {thread}\n"
63+
all_clean = False
64+
for task in asyncio.all_tasks():
65+
if not (task.get_name() in start_tasks or "wrap_asyncgen_fixture" in str(task)):
66+
error_text += f"-->TASK: {task}\n"
67+
all_clean = False
68+
if all_clean:
69+
break
70+
await asyncio.sleep(1)
6771
assert all_clean, error_text
6872
assert not NullModem.is_dirty()
6973

0 commit comments

Comments
 (0)