diff --git a/test/unit/app/queue_worker/conftest.py b/test/unit/app/queue_worker/conftest.py index b117847b40c..3849e7b8690 100644 --- a/test/unit/app/queue_worker/conftest.py +++ b/test/unit/app/queue_worker/conftest.py @@ -4,13 +4,17 @@ from typing import Optional import pytest +try: + import psycopg +except ImportError: + psycopg = None + try: import psycopg2 except ImportError: psycopg2 = None from galaxy.app_unittest_utils import galaxy_mock -from galaxy.util import which def create_base_test(connection, amqp_type: str, amqp_connection: Optional[str] = None): @@ -48,9 +52,6 @@ def sqlite_app(sqlite_connection): def postgres_app(postgresql_proc): connection = "postgresql://{p.user}@{p.host}:{p.port}/".format(p=postgresql_proc) - if not psycopg2: - pytest.skip("psycopg2 must be installed for postgresql fixture") - def create_app(): return create_base_test(connection, amqp_type="postgres") @@ -60,12 +61,11 @@ def postgres_app(postgresql_proc): @pytest.fixture(params=["postgres_app", "sqlite_app", "sqlite_rabbitmq_app"]) def database_app(request): if request.param == "postgres_app": - if not which("initdb"): - pytest.skip("initdb must be on PATH for postgresql fixture") + if not psycopg: + pytest.skip("psycopg must be installed for postgresql_proc fixture") + if not psycopg2: + pytest.skip("psycopg2 must be installed for database_app fixture") if request.param == "sqlite_rabbitmq_app": if not os.environ.get("GALAXY_TEST_AMQP_INTERNAL_CONNECTION"): pytest.skip("rabbitmq tests will be skipped if GALAXY_TEST_AMQP_INTERNAL_CONNECTION env var is unset") - try: - return request.getfixturevalue(request.param) - except ImportError: - pytest.skip("psycopg2 must be installed for postgresql fixture") + return request.getfixturevalue(request.param)