aboutsummaryrefslogtreecommitdiff
path: root/test_pytest/test_main.py
diff options
context:
space:
mode:
Diffstat (limited to 'test_pytest/test_main.py')
-rw-r--r--test_pytest/test_main.py33
1 files changed, 33 insertions, 0 deletions
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)