diff --git a/janus/__init__.py b/janus/__init__.py index 28cc317..14150a7 100644 --- a/janus/__init__.py +++ b/janus/__init__.py @@ -16,7 +16,7 @@ try: ensure_future = asyncio.ensure_future except AttributeError: - ensure_future = asyncio.async + ensure_future = getattr(asyncio, 'async') class Queue: diff --git a/tests/test_async.py b/tests/test_async.py index 2c9bb5f..1c15864 100644 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -178,7 +178,7 @@ def test_get_with_putters(self): @asyncio.coroutine def put(): - t = asyncio.async(q.put(2), loop=self.loop) + t = janus.ensure_future(q.put(2), loop=self.loop) yield from asyncio.sleep(0.01, loop=self.loop) fut.set_result(None) return t