Skip to content

Commit

Permalink
Refine default behaviour of config engine to support easier migration…
Browse files Browse the repository at this point in the history
… from 1.8
  • Loading branch information
SpacemanPaul committed Apr 9, 2024
1 parent 9561764 commit b283878
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion datacube/cfg/api.py
Expand Up @@ -220,7 +220,9 @@ def __getitem__(self, item: str | None) -> "ODCEnvironment":
"this fallback behaviour is deprecated and may change in a future release.")
item = "datacube"
else:
raise ConfigException("No environment specified and no default environment could be identified.")
# No explicitly defined (known) environments - assume default and hope there's config
# available in environment variables.
item = "default"
if item not in self.known_environments:
self.known_environments[item] = ODCEnvironment(self, item, {}, True)
return self.known_environments[item]
Expand Down
3 changes: 2 additions & 1 deletion docs/about/whats_new.rst
Expand Up @@ -8,7 +8,8 @@ What's New
v1.9.next
=========

- Standardize resampling input supported to `odc.geo.warp.Resampling`.
- Standardize resampling input supported to `odc.geo.warp.Resampling` (:pull:`1571`)
- Refine default behaviour for config engine to support easier migration from 1.8 (:pull:`1573`)


v1.9.0-rc3 (27th March 2024)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_cfg.py
Expand Up @@ -542,5 +542,4 @@ def test_default_environment(simple_config, monkeypatch):
'weirdname': {"index_driver": "memory"},
'stupidenv': {"index_driver": "null"},
})
with pytest.raises(ConfigException):
cfg[None]._name
assert cfg[None]._name == "default"

0 comments on commit b283878

Please sign in to comment.