test_async.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 import pytest
3 
4 asyncio = pytest.importorskip("asyncio")
5 m = pytest.importorskip("pybind11_tests.async_module")
6 
7 
8 @pytest.fixture
9 def event_loop():
10  loop = asyncio.new_event_loop()
11  yield loop
12  loop.close()
13 
14 
15 async def get_await_result(x):
16  return await x
17 
18 
19 def test_await(event_loop):
20  assert 5 == event_loop.run_until_complete(get_await_result(m.SupportsAsync()))
21 
22 
23 def test_await_missing(event_loop):
24  with pytest.raises(TypeError):
25  event_loop.run_until_complete(get_await_result(m.DoesNotSupportAsync()))
def event_loop()
Definition: test_async.py:9
def get_await_result(x)
Definition: test_async.py:15
def test_await_missing(event_loop)
Definition: test_async.py:23
def test_await(event_loop)
Definition: test_async.py:19


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:46:02