Skip to content

Commit aca2390

Browse files
committed
test: Check that Cython coroutines are supported by ensure_future
1 parent 5213f8a commit aca2390

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/test_base.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,18 @@ def coro():
396396

397397

398398
class TestBaseUV(_TestBase, UVTestCase):
399-
pass
399+
400+
def test_cython_coro_is_coroutine(self):
401+
coro = self.loop.create_server(object)
402+
self.assertTrue(asyncio.iscoroutine(coro))
403+
fut = asyncio.ensure_future(coro, loop=self.loop)
404+
self.assertTrue(isinstance(fut, asyncio.Future))
405+
fut.cancel()
406+
try:
407+
self.loop.run_until_complete(fut)
408+
except asyncio.CancelledError:
409+
pass
410+
coro.close()
400411

401412

402413
class TestBaseAIO(_TestBase, AIOTestCase):

0 commit comments

Comments
 (0)