Пример #1
0
 def setUp(self):
     app = create_app()
     app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite://"
     app.app_context().push()
     db.create_all()
     DbTestCase.seed()
Пример #2
0
    def setUp(self):

        self.app = create_app(config='test')
        self.client = self.app.test_client()
Пример #3
0
import tracemalloc
import asyncio
import redis
from sanic import response

from domain import commands
from entrypoint import create_app
from service_layer import unit_of_work, handlers
from utils import utils

app = asyncio.run(create_app())
bus = utils.get_bootstrap(app)

tracemalloc.start()

r = redis.Redis(host='127.0.0.1', port=6379)


@app.main_process_start
async def start_db(app, loop):
    print("DB connected")
    await app.ctx.db.connect()
    print(app.ctx.db.is_connected)


@app.main_process_stop
async def stop_db(app, loop):
    print("DB Disconnected")
    # await app.ctx.db.disconnect()