https://github.com/python/cpython/commit/eadb9660ed836b40667d4f662eae90287ff18397
commit: eadb9660ed836b40667d4f662eae90287ff18397
branch: main
author: Loïc Estève <[email protected]>
committer: JelleZijlstra <[email protected]>
date: 2024-09-13T11:13:30-07:00
summary:

gh-122957: Fix test flakiness in asyncio test in free-thread build (#124039)

files:
M Lib/test/test_asyncio/test_threads.py

diff --git a/Lib/test/test_asyncio/test_threads.py 
b/Lib/test/test_asyncio/test_threads.py
index 1138a93e0f78ec..774380270a7d70 100644
--- a/Lib/test/test_asyncio/test_threads.py
+++ b/Lib/test/test_asyncio/test_threads.py
@@ -30,7 +30,9 @@ async def test_to_thread_once(self):
         func.assert_called_once()
 
     async def test_to_thread_concurrent(self):
-        func = mock.Mock()
+        calls = []
+        def func():
+            calls.append(1)
 
         futs = []
         for _ in range(10):
@@ -38,7 +40,7 @@ async def test_to_thread_concurrent(self):
             futs.append(fut)
         await asyncio.gather(*futs)
 
-        self.assertEqual(func.call_count, 10)
+        self.assertEqual(sum(calls), 10)
 
     async def test_to_thread_args_kwargs(self):
         # Unlike run_in_executor(), to_thread() should directly accept kwargs.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to