@pytest.fixture(scope='session')
def db(app):
    _db.drop_all()
    _db.create_all()

    # Create a single user because a lot of tests do not mutate this user.
    # It will result in quite a bit faster tests.
    params = {
        'role': 'admin',
        'email': 'admin@localhost.com',
        'name': 'Dev',
        'password': 'password'
    }

    admin = User(**params)

    _db.session.add(admin)
    _db.session.commit()

    return _db
Setup our database, this only gets executed once per session.
dataset/ETHPy150Open nickjj/build-a-saas-app-with-flask/catwatch/tests/conftest.py/db