Skip to content

Commit

Permalink
drop importlib_resource legacy API usage
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Jul 17, 2023
1 parent 8d8b27c commit a9d5c6c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion openeogeotrellis/config/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __call__(self, force_reload: bool = False) -> GpsBackendConfig:
return self.get(force_reload=force_reload)

def _default_config(self) -> ContextManager[Path]:
return importlib_resources.path("openeogeotrellis.config", "default.py")
return importlib_resources.as_file(importlib_resources.files("openeogeotrellis.config") / "default.py")


# Singleton getter.
Expand Down
5 changes: 5 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,8 @@ def test_get_backend_config_lazy_cache(self, tmp_path, monkeypatch):
# Force reload should fail
with pytest.raises(FileNotFoundError):
_ = get_backend_config(force_reload=True)

def test_default_config(self, monkeypatch):
monkeypatch.delenv("OPENEO_BACKEND_CONFIG")
config = get_backend_config()
assert config.id == "gps-default"

0 comments on commit a9d5c6c

Please sign in to comment.