summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Grönholm <alex.gronholm@nextday.fi>2022-09-21 02:20:25 +0300
committerAlex Grönholm <alex.gronholm@nextday.fi>2022-09-21 02:40:02 +0300
commitb201d9a2cceabb6412b9d4b4abd325e25d423aa2 (patch)
tree1f67096a1c5ab9fd51bdcbcf8bab57492ef836a3
parente8055bce55bb004168b5787f89091057cf1f36c7 (diff)
downloadapscheduler-b201d9a2cceabb6412b9d4b4abd325e25d423aa2.tar.gz
Fixed missing schema with the psycopg2 store fixture
-rw-r--r--tests/conftest.py6
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()