From 1e874e790c12839695761a654b44fb427149a353 Mon Sep 17 00:00:00 2001 From: "bozo.kopic" Date: Wed, 28 Jul 2021 01:43:55 +0200 Subject: init --- test_pytest/test_main.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test_pytest/test_main.py (limited to 'test_pytest/test_main.py') diff --git a/test_pytest/test_main.py b/test_pytest/test_main.py new file mode 100644 index 0000000..dd61c5f --- /dev/null +++ b/test_pytest/test_main.py @@ -0,0 +1,33 @@ +import asyncio +import pytest + +from hat import aio +from hat import util + +import restlog.main + + +pytestmark = pytest.mark.asyncio + + +@pytest.fixture +def conf(tmp_path): + return {'log': {'version': 1}, + 'host': '127.0.0.1', + 'port': util.get_unused_tcp_port(), + 'db_path': str((tmp_path / 'restlog.db').resolve()), + 'max_results': 100} + + +@pytest.fixture +async def main(conf): + async_group = aio.Group() + try: + async_group.spawn(restlog.main.async_main, conf) + yield + finally: + await async_group.async_close() + + +async def test_run(main): + await asyncio.sleep(0.01) -- cgit v1.2.3-70-g09d2