diff --git a/tests/test_api_images.py b/tests/test_api_images.py index f9357f94..7c561f1f 100644 --- a/tests/test_api_images.py +++ b/tests/test_api_images.py @@ -2431,6 +2431,9 @@ class TestSharedListing(ImageAPITestCase): async def settle(): while self.api._listing_tasks: await asyncio.gather(*list(self.api._listing_tasks)) + # A finished walk leaves the set in a done callback, which needs + # a loop turn; gather over finished tasks does not yield one. + await asyncio.sleep(0) await asyncio.wait_for(settle(), _HANG_LIMIT) diff --git a/tests/test_api_workspace_images.py b/tests/test_api_workspace_images.py index cd8fe396..dceae1f6 100644 --- a/tests/test_api_workspace_images.py +++ b/tests/test_api_workspace_images.py @@ -196,6 +196,9 @@ class TestWorkspaceImages(ImageAPITestCase): await self.get() # served at once; one background walk runs while self.api._listing_tasks: await asyncio.gather(*list(self.api._listing_tasks)) + # A finished walk leaves the set in a done callback, which needs + # a loop turn; gather over finished tasks does not yield one. + await asyncio.sleep(0) _, again = await self.get() self.assertEqual(scan.call_count, 1) self.assertIs(record.files, files)