24 lines
No EOL
508 B
Python
24 lines
No EOL
508 B
Python
import pytest
|
|
from app import create_app
|
|
from app.core.extensions import db as _db
|
|
|
|
@pytest.fixture
|
|
def app():
|
|
app = create_app('testing')
|
|
app.config['TESTING'] = True
|
|
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:'
|
|
|
|
with app.app_context():
|
|
_db.create_all()
|
|
yield app
|
|
_db.session.remove()
|
|
_db.drop_all()
|
|
|
|
@pytest.fixture
|
|
def client(app):
|
|
return app.test_client()
|
|
|
|
@pytest.fixture
|
|
def db(app):
|
|
with app.app_context():
|
|
yield _db |