Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate PPP_CONFIG_DIR for specifying config path #170

Merged
merged 6 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 5 additions & 26 deletions pyorbital/tests/test_tlefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,39 +183,18 @@ def test_check_is_platform_supported_unknown(caplog):
assert expected3 in logoutput_lines[2]


#def test_get_config_path_ppp_config_set_but_not_pyorbital_future(mock, caplog, monkeypatch):
# """Test getting the config path."""
# monkeypatch.setenv("SATPY_CONFIG_PATH", "/path/to/satpy/etc")
# monkeypatch.setenv("PPP_CONFIG_DIR", "/path/to/old/mpop/config/dir")
#
# with caplog.at_level(logging.WARNING):
# res = _get_config_path()
#
# log_output = ("The use of PPP_CONFIG_DIR is no longer supported! " +
# "Please use PYORBITAL_CONFIG_PATH if you need a custom config path for pyorbital!")
# assert log_output in caplog.text
# assert res == PKG_CONFIG_DIR


def test_get_config_path_ppp_config_set_but_not_pyorbital_is_deprecated(caplog, monkeypatch):
"""Test getting the config path.

Here the case is tested when the new Pyorbital environment variable is not
set but the deprecated (old) Satpy/MPOP one is set.

"""
def test_get_config_path_ppp_config_set_but_not_pyorbital_future(caplog, monkeypatch):
"""Test getting the config path."""
monkeypatch.setenv("SATPY_CONFIG_PATH", "/path/to/satpy/etc")
monkeypatch.setenv("PPP_CONFIG_DIR", "/path/to/old/mpop/config/dir")

with caplog.at_level(logging.WARNING):
res = _get_config_path()

assert res == "/path/to/old/mpop/config/dir"

log_output = ("The use of PPP_CONFIG_DIR is deprecated and will be removed in version 1.9!" +
" Please use PYORBITAL_CONFIG_PATH if you need a custom config path for pyorbital!")

log_output = ("The use of PPP_CONFIG_DIR is no longer supported! " +
"Please use PYORBITAL_CONFIG_PATH if you need a custom config path for pyorbital!")
assert log_output in caplog.text
assert res == PKG_CONFIG_DIR


def test_get_config_path_ppp_config_set_and_pyorbital(caplog, monkeypatch):
Expand Down
11 changes: 3 additions & 8 deletions pyorbital/tlefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,11 @@ class TleDownloadTimeoutError(Exception):
def _get_config_path():
"""Get the config path for Pyorbital."""
if "PPP_CONFIG_DIR" in os.environ and "PYORBITAL_CONFIG_PATH" not in os.environ:
# XXX: Swap when pyorbital 1.9 is released
#LOGGER.warning(
# "The use of PPP_CONFIG_DIR is no longer supported!" +
# " Please use PYORBITAL_CONFIG_PATH if you need a custom config path for pyorbital!")
#LOGGER.debug("Using the package default for configuration: %s", PKG_CONFIG_DIR)
#return PKG_CONFIG_DIR
LOGGER.warning(
"The use of PPP_CONFIG_DIR is deprecated and will be removed in version 1.9!" +
"The use of PPP_CONFIG_DIR is no longer supported!" +
" Please use PYORBITAL_CONFIG_PATH if you need a custom config path for pyorbital!")
pyorbital_config_path = os.getenv("PPP_CONFIG_DIR", PKG_CONFIG_DIR)
LOGGER.debug("Using the package default for configuration: %s", PKG_CONFIG_DIR)
return PKG_CONFIG_DIR
else:
pyorbital_config_path = os.getenv("PYORBITAL_CONFIG_PATH", PKG_CONFIG_DIR)

Expand Down
Loading