From fdf336afa017c24eb483f741e4037226f8a08401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Mon, 31 Oct 2016 01:12:50 +0100 Subject: Use ensure_future if available, otherwise use asyncio.async --- tests/end_to_end/__main__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/end_to_end/__main__.py') diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py index a591bc9..c98c3a6 100644 --- a/tests/end_to_end/__main__.py +++ b/tests/end_to_end/__main__.py @@ -13,6 +13,8 @@ import os from functools import partial from slixmpp.xmlstream.matcher.base import MatcherBase +if not hasattr(asyncio, "ensure_future"): + asyncio.ensure_future = getattr(asyncio, "async") class MatchAll(MatcherBase): """match everything""" @@ -57,7 +59,7 @@ class XMPPComponent(slixmpp.BaseXMPP): self.add_event_handler("session_end", self.on_end_session) - asyncio.async(self.accept_routine()) + asyncio.ensure_future(self.accept_routine()) self.scenario = scenario self.biboumi = biboumi -- cgit v1.2.3