flask-demo-api/tests/conftest.py

28 lines
555 B
Python
Raw Permalink Normal View History

2024-04-16 01:03:02 +03:00
import pytest
from dishka.integrations.flask import setup_dishka
from flask import Flask
from flask_demo_api.ioc import create_container
from flask_demo_api.main import app_factory
@pytest.fixture(scope="session", autouse=True)
def app():
app: Flask = app_factory()
app.config.update(
{
"TESTING": True,
}
)
container = create_container()
setup_dishka(container=container, app=app, auto_inject=True)
yield app
container.close()
@pytest.fixture()
def client(app):
return app.test_client()