From 78abe7cc4114f76a987791d827b432704b2a14c6 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 18 Jul 2014 19:12:57 +0200 Subject: [PATCH] Fix test_task_yield_from_invalid() The exact error message depends on the version of Trollius and Tulip, if they have the new create_task() function. The check may be removed later when Trollius and Tulip with create_task() will be widely deployed. --- tests/test_tasks.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_tasks.py b/tests/test_tasks.py index 7944272..049d581 100644 --- a/tests/test_tasks.py +++ b/tests/test_tasks.py @@ -149,8 +149,12 @@ class TaskTests(TestCase): def bar(): pass - err_msg = (r"^greenlet.yield_from was supposed to receive " - r"only Futures, got .* in task .*$") + if hasattr(asyncio.AbstractEventLoop, 'create_task'): + err_msg = (r"^greenlet.yield_from was supposed to receive " + r"only Futures, got .* in task .*$") + else: + err_msg = (r'^"greenio\.yield_from" was supposed to be called ' + r'from a "greenio\.task" or a subsequent coroutine$') @asyncio.coroutine def foo():