Exemple #1
0
    def __init__(self, config):
        self.loop = asyncio.get_event_loop()
        conf = create_config(config)

        logging.config.dictConfig(conf['logging'])

        self.logger = logging.getLogger('wallet')
        self.instance = self.loop.run_until_complete(init(conf, self.logger,
                                                          self.loop))
Exemple #2
0
from typing import Dict

from aiohttp import ClientSession
import pytest

from alembic.config import Config as AlembicConfig
from alembic import command

from .handlers import create_owner, create_account, create_category, \
    create_transaction

from wallet.app import init, create_config
from wallet.utils.handlers import reverse_url


config = create_config()


@pytest.yield_fixture
def loop(request):
    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)

    yield loop

    if not loop._closed:
        loop.stop()
        loop.run_forever()
        loop.close()
    gc.collect()
    asyncio.set_event_loop(None)