diff --git a/libs/foundry-dev-tools/src/foundry_dev_tools/config/config.py b/libs/foundry-dev-tools/src/foundry_dev_tools/config/config.py index c6ad93b..2f3742c 100644 --- a/libs/foundry-dev-tools/src/foundry_dev_tools/config/config.py +++ b/libs/foundry-dev-tools/src/foundry_dev_tools/config/config.py @@ -227,7 +227,9 @@ def parse_credentials_config(config_dict: dict | None) -> TokenProvider: try: tp_name, tp_config = credentials_config.popitem() # make it possible to do jwt = "eyJ" instead of jwt = {jwt="eyJ"} - if not isinstance(tp_config, dict): + if tp_config is None or len(tp_config) == 0: + tp_config = {} + elif not isinstance(tp_config, dict): tp_config = {tp_name: tp_config} except KeyError: tp_name, tp_config = None, None diff --git a/tests/unit/config/test_context.py b/tests/unit/config/test_context.py index 1fe3f29..70b1818 100644 --- a/tests/unit/config/test_context.py +++ b/tests/unit/config/test_context.py @@ -1,6 +1,7 @@ from __future__ import annotations import os +import warnings from typing import TYPE_CHECKING from unittest import mock @@ -15,11 +16,13 @@ def test_app_service(mock_config_location: dict[Path, None]): - with ( + with ( # noqa: PT012 mock.patch.dict(os.environ, {"APP_SERVICE_TS": "1", "FDT_CREDENTIALS__DOMAIN": TEST_DOMAIN}, clear=True), pytest.raises( FoundryConfigError, match="Could not get Foundry token from flask/dash/streamlit headers.", ), + warnings.catch_warnings(), ): + warnings.simplefilter("error") # raise errors on warnings _ = FoundryContext()