aboutsummaryrefslogtreecommitdiffstats
path: root/templates/{{cookiecutter.tests_dir}}/test_{{cookiecutter.service_slug}}.py
blob: e1932059b25b8390dc1e64592ae39760d65ac8a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import asyncio
import os
import pytest
import logging
from pyagl.services.base import AFBResponse, AFBT
from concurrent.futures import TimeoutError

from pyagl.services.{{cookiecutter.service_slug}} import {{cookiecutter.classname}}
pytestmark = pytest.mark.asyncio

@pytest.fixture(scope='module')
def event_loop():
    loop = asyncio.get_event_loop()
    yield loop
    loop.close()

@pytest.fixture(scope='module')
async def service():
    address = os.environ.get('AGL_TGT_IP', 'localhost')
    port = os.environ.get('AGL_TGT_PORT', None)
    svc = await {{cookiecutter.classname}}(ip=address, port=port)
    yield svc
    await svc.websocket.close()