Merge commit 'f34e604d3b4bee5339ec4e9c9f36619b17f52e32' as 'examples/knxPython/pybind11'

This commit is contained in:
Thomas Kunze
2020-10-28 21:09:58 +01:00
220 changed files with 48608 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
import pytest
asyncio = pytest.importorskip("asyncio")
m = pytest.importorskip("pybind11_tests.async_module")
@pytest.fixture
def event_loop():
loop = asyncio.new_event_loop()
yield loop
loop.close()
async def get_await_result(x):
return await x
def test_await(event_loop):
assert 5 == event_loop.run_until_complete(get_await_result(m.SupportsAsync()))
def test_await_missing(event_loop):
with pytest.raises(TypeError):
event_loop.run_until_complete(get_await_result(m.DoesNotSupportAsync()))