From 80159d8789fe2ea0b36d84b83348813f67e18652 Mon Sep 17 00:00:00 2001 From: Edi Feschiyan <553226+refresher@users.noreply.github.com> Date: Thu, 18 Jun 2020 13:12:31 +0300 Subject: Rearranging files for distribution, setup.py modifications --- .../test_{{cookiecutter.service_slug}}.py | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 templates/{{cookiecutter.tests_dir}}/test_{{cookiecutter.service_slug}}.py (limited to 'templates/{{cookiecutter.tests_dir}}') diff --git a/templates/{{cookiecutter.tests_dir}}/test_{{cookiecutter.service_slug}}.py b/templates/{{cookiecutter.tests_dir}}/test_{{cookiecutter.service_slug}}.py new file mode 100644 index 0000000..e193205 --- /dev/null +++ b/templates/{{cookiecutter.tests_dir}}/test_{{cookiecutter.service_slug}}.py @@ -0,0 +1,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() -- cgit 1.2.3-korg