aboutsummaryrefslogtreecommitdiff
path: root/test_pytest/test_main.py
blob: dd61c5f21c050ab46b7ff0b18697c47b1437fddc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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)