harp_apps.storage.conftest

blob_storage(request, sql_engine)[source]
database_url(request)[source]
redis_blob_storage()[source]
sql_blob_storage(sql_engine)[source]
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

sql_storage(sql_engine, blob_storage)[source]
Return type:

SqlStorage