I want to seed an in-memory Sqlite3 database as part of a pytest fixture.
The documentation of flask-seeder just describes calling the seeder via the CLI. A quick trial to call seed_run() seems to work with some nasty hacks, but is obviously not the intended way of calling.
My current code (excerpt):
from flask_migrate import upgrade
from flask_seeder.cli import seed_run
@pytest.fixture(name="app")
def fixture_app():
app = create_app(TestingConfig())
# setup the database
with app.app_context():
upgrade()
seed_run(args=[], standalone_mode=False)
yield app
Are there better ways to achieve this task with flask-seeder?
As there is apparently no other entry point in the code for running the seeds, might this be a feature to add?
I want to seed an in-memory Sqlite3 database as part of a pytest fixture.
The documentation of flask-seeder just describes calling the seeder via the CLI. A quick trial to call
seed_run()
seems to work with some nasty hacks, but is obviously not the intended way of calling.My current code (excerpt):
Are there better ways to achieve this task with flask-seeder?
As there is apparently no other entry point in the code for running the seeds, might this be a feature to add?