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.
This commit is contained in:
Victor Stinner 2014-07-18 19:12:57 +02:00
parent c0ec5da9fb
commit 78abe7cc41
1 changed files with 6 additions and 2 deletions

View File

@ -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():