Skip to content

Commit 68391f8

Browse files
skip one test
1 parent 4f807ca commit 68391f8

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Lib/test/test_asyncio/test_waitfor.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,34 @@ async def inner():
237237
with self.assertRaises(FooException):
238238
await foo()
239239

240+
@unittest.skip("TODO")
241+
async def test_wait_for_self_cancellation(self):
242+
async def inner():
243+
try:
244+
await asyncio.sleep(0.3)
245+
except asyncio.CancelledError:
246+
try:
247+
await asyncio.sleep(0.3)
248+
except asyncio.CancelledError:
249+
await asyncio.sleep(0.3)
250+
251+
return 42
252+
253+
inner_task = asyncio.create_task(inner())
254+
255+
wait = asyncio.wait_for(inner_task, timeout=0.1)
256+
257+
# Test that wait_for itself is properly cancellable
258+
# even when the initial task holds up the initial cancellation.
259+
task = asyncio.create_task(wait)
260+
await asyncio.sleep(0.2)
261+
task.cancel()
262+
263+
with self.assertRaises(asyncio.CancelledError):
264+
await task
265+
266+
self.assertEqual(await inner_task, 42)
267+
240268
async def _test_cancel_wait_for(self, timeout):
241269
loop = asyncio.get_running_loop()
242270

0 commit comments

Comments
 (0)