harp_apps.storage.conftest¶
- sql_engine(database_url, test_id)[source]¶
Use a DMBS conncetion string to create a sqlalchemy async engine to a new isolated database that will gets an initial status/structure/schema by executing migrations on it, whatever the migration process is for the given URL (for example, sqlite will use a simple create_all strategy, while postgres or mysql will use alembic).
This looks a bit overkill, but this is the simplest way to guarantee isolated and repeatable tests that depends on databases.
The isolated database name will be based on the test_id fixture value, which will create an unique hash string for each test.
- Return type:
AsyncEngine