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


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:37:45