Skip to content

Commit ede0c49

Browse files
use a less strict test
1 parent 1d3a37d commit ede0c49

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Lib/test/test_asyncio/test_free_threading.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,23 @@ async def coro():
6767
await asyncio.sleep(0.01)
6868

6969
lock = threading.Lock()
70-
count = 0
70+
tasks = set()
7171

7272
async def main():
73-
nonlocal count, loop
73+
nonlocal tasks, loop
7474
loop = asyncio.get_running_loop()
7575
started.set()
7676
for i in range(1000):
7777
with lock:
7878
asyncio.create_task(coro())
79-
count = len(self.all_tasks(loop))
79+
tasks = self.all_tasks(loop)
8080

8181
runner = threading.Thread(target=lambda: asyncio.run(main()))
8282

8383
def check():
8484
started.wait()
8585
with lock:
86-
self.assertEqual(count, len(self.all_tasks(loop)))
86+
self.assertSetEqual(tasks & self.all_tasks(loop), tasks)
8787

8888
threads = [threading.Thread(target=check) for _ in range(10)]
8989
threads.append(runner)

0 commit comments

Comments
 (0)