Here are the examples of the python api pytest.mark.async taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
0
Example 1
@pytest.mark.async
def test_async():
yield from asyncio.sleep(.1)
assert True
0
Example 2
@pytest.mark.async
def test_local(loop):
l1 = muffin.local(loop)
l2 = muffin.local(loop)
assert l1 is l2
log, fut1, fut2 = [], asyncio.Future(), asyncio.Future()
@asyncio.coroutine
def coro1():
l1.value = 'task1'
yield from fut1
log.append(l1.value)
fut2.set_result(True)
@asyncio.coroutine
def coro2():
l1.value = 'task2'
fut1.set_result(True)
yield from fut2
log.append(l1.value)
yield from asyncio.wait([coro1(), coro2()])
assert log == ['task1', 'task2']