diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-09-23 18:07:41 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-23 18:07:41 (GMT) |
| commit | 4cd4bf10be1415f93c02cec1d454d4342df3f053 (patch) | |
| tree | 040f8b0e13e5c8854f82df11a61fe117ecd65321 /Lib/test/test_asyncio/test_threads.py | |
| parent | 72139f276e1c7753727a72b48899718ee871b4a4 (diff) | |
| download | cpython-4cd4bf10be1415f93c02cec1d454d4342df3f053.zip cpython-4cd4bf10be1415f93c02cec1d454d4342df3f053.tar.gz cpython-4cd4bf10be1415f93c02cec1d454d4342df3f053.tar.bz2 | |
[3.13] gh-122957: Fix test flakiness in asyncio test in free-thread build (GH-124039) (#124067)
gh-122957: Fix test flakiness in asyncio test in free-thread build (GH-124039)
(cherry picked from commit eadb9660ed836b40667d4f662eae90287ff18397)
Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
Diffstat (limited to 'Lib/test/test_asyncio/test_threads.py')
| -rw-r--r-- | Lib/test/test_asyncio/test_threads.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_asyncio/test_threads.py b/Lib/test/test_asyncio/test_threads.py index 1138a93..7743802 100644 --- a/Lib/test/test_asyncio/test_threads.py +++ b/Lib/test/test_asyncio/test_threads.py @@ -30,7 +30,9 @@ class ToThreadTests(unittest.IsolatedAsyncioTestCase): 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 @@ class ToThreadTests(unittest.IsolatedAsyncioTestCase): 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. |
