Maybe it is something with how you set up a test client. From the first glance it looks okay. I did something similar but used a postgres database for testing.
# a single method to create app for both testing and running
def create_app():
app = Flask(
__name__,
)
app.config.from_object(config_class)
db.init_app(app) # <- this db is the same which you are using in the main app
Migrate(app, db)
# register endpoints
# app.register_blueprint(some_blp)
return app
@pytest.fixture(scope="session")
def app():
test_app = construct_app(app)
with test_app.test_client() as cl:
with test_app.app_context():
db.create_all()
yield cl
with test_app.app_context():
db.session.commit()
db.drop_all()
This setup should work.
You can check my pet project (repo) which I did in the past where I also wrote tests. It was one of the first projects I had written on flask so there things I would do differently.