From c8a1581e0651021587540257c2ef21993bbfed04 Mon Sep 17 00:00:00 2001 From: John Davis Date: Thu, 13 Oct 2022 13:17:33 -0400 Subject: [PATCH] Assign values from env using new utility function Also, fix error: don't break out early as both values should be assigned. --- lib/galaxy_test/base/api.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/galaxy_test/base/api.py b/lib/galaxy_test/base/api.py index 7b41f1b4699..80e24f6017d 100644 --- a/lib/galaxy_test/base/api.py +++ b/lib/galaxy_test/base/api.py @@ -14,6 +14,7 @@ from urllib.parse import ( import pytest import requests +from galaxy.util.properties import get_from_env from .api_asserts import ( assert_error_code_is, assert_has_keys, @@ -31,15 +32,8 @@ from .api_util import ( from .interactor import TestCaseGalaxyInteractor as BaseInteractor CONFIG_PREFIXES = ["GALAXY_TEST_CONFIG_", "GALAXY_CONFIG_OVERRIDE_", "GALAXY_CONFIG_"] -DEFAULT_CELERY_BROKER = "memory://" -DEFAULT_CELERY_BACKEND = "rpc://localhost" -for prefix in CONFIG_PREFIXES: - CELERY_BROKER = os.environ.get(f"{prefix}CELERY_BROKER", DEFAULT_CELERY_BROKER) - if CELERY_BROKER != DEFAULT_CELERY_BROKER: - break - CELERY_BACKEND = os.environ.get(f"{prefix}CELERY_BACKEND", DEFAULT_CELERY_BACKEND) - if CELERY_BACKEND != DEFAULT_CELERY_BACKEND: - break +CELERY_BROKER = get_from_env("CELERY_BROKER", CONFIG_PREFIXES, "memory://") +CELERY_BACKEND = get_from_env("CELERY_BACKEND", CONFIG_PREFIXES, "rpc://localhost") @pytest.fixture(scope="session")