diff options
Diffstat (limited to 'tests/conftest.py')
-rw-r--r-- | tests/conftest.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 7497b52..6b3de78 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -141,13 +141,17 @@ def sqlite_store() -> DataStore: @pytest.fixture def psycopg2_store() -> DataStore: + from sqlalchemy import text from sqlalchemy.future import create_engine from apscheduler.datastores.sqlalchemy import SQLAlchemyDataStore engine = create_engine("postgresql+psycopg2://postgres:secret@localhost/testdb") try: - yield SQLAlchemyDataStore(engine, schema="alter", start_from_scratch=True) + with engine.begin() as conn: + conn.execute(text("CREATE SCHEMA IF NOT EXISTS psycopg2")) + + yield SQLAlchemyDataStore(engine, schema="psycopg2", start_from_scratch=True) finally: engine.dispose() |