From 383f434346c5fad269e6df27a054baa5b60d21c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= Date: Fri, 2 Aug 2024 12:59:23 +0300 Subject: [PATCH] Moved importorskip() for psycopg in the correct place(s) --- tests/conftest.py | 2 ++ tests/test_datastores.py | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 273b8d242..f3aa1077a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -156,6 +156,7 @@ async def psycopg_async_store() -> AsyncGenerator[DataStore, None]: from apscheduler.datastores.sqlalchemy import SQLAlchemyDataStore + pytest.importorskip("psycopg", reason="psycopg not available") engine = create_async_engine( "postgresql+psycopg://postgres:secret@localhost/testdb" ) @@ -177,6 +178,7 @@ def psycopg_sync_store() -> Generator[DataStore, None, None]: from apscheduler.datastores.sqlalchemy import SQLAlchemyDataStore + pytest.importorskip("psycopg", reason="psycopg not available") engine = create_engine("postgresql+psycopg://postgres:secret@localhost/testdb") try: with engine.begin() as conn: diff --git a/tests/test_datastores.py b/tests/test_datastores.py index 3efa528a2..8e10b39b3 100644 --- a/tests/test_datastores.py +++ b/tests/test_datastores.py @@ -840,7 +840,6 @@ async def test_aiosqlite( ) async def test_psycopg(self, psycopg_async_store: SQLAlchemyDataStore) -> None: - pytest.importorskip("psycopg") assert repr(psycopg_async_store) == ( "SQLAlchemyDataStore(url='postgresql+psycopg://postgres:***@localhost/" "testdb', schema='psycopg_async')"