Skip to content

Commit

Permalink
Use DAF_BUTLER_REPOSITORY_INDEX as env var
Browse files Browse the repository at this point in the history
This is consistent with other butler environment variables
that start with DAF_BUTLER and not BUTLER_.
  • Loading branch information
timj committed Nov 19, 2021
1 parent 23808df commit a4b0579
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions python/lsst/daf/butler/_butlerRepoIndex.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ButlerRepoIndex:
The index of butler repositories is found by looking for a
configuration file at the URI pointed at by the environment
variable ``$BUTLER_REPOSITORY_INDEX``. The configuration file
variable ``$DAF_BUTLER_REPOSITORY_INDEX``. The configuration file
is a simple dictionary lookup of the form:
.. code-block:: yaml
Expand All @@ -54,7 +54,7 @@ class ButlerRepoIndex:
cached.
"""

index_env_var: ClassVar[str] = "BUTLER_REPOSITORY_INDEX"
index_env_var: ClassVar[str] = "DAF_BUTLER_REPOSITORY_INDEX"
"""The name of the environment variable to read to locate the index."""

_cache: ClassVar[Dict[ButlerURI, Config]] = {}
Expand Down
4 changes: 2 additions & 2 deletions tests/test_butler.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def testConstructor(self):
butler_index["bad_label"] = bad_label
with ButlerURI.temporary_uri(suffix=suffix) as temp_file:
butler_index.dumpToUri(temp_file)
with unittest.mock.patch.dict(os.environ, {"BUTLER_REPOSITORY_INDEX": str(temp_file)}):
with unittest.mock.patch.dict(os.environ, {"DAF_BUTLER_REPOSITORY_INDEX": str(temp_file)}):
self.assertEqual(Butler.get_known_repos(), set(("label", "bad_label")))
uri = Butler.get_repo_uri("bad_label")
self.assertEqual(uri, ButlerURI(bad_label))
Expand All @@ -503,7 +503,7 @@ def testConstructor(self):
with self.assertRaises(KeyError) as cm:
Butler.get_repo_uri("missing")
self.assertIn("not known to", str(cm.exception))
with unittest.mock.patch.dict(os.environ, {"BUTLER_REPOSITORY_INDEX": "file://not_found/x.yaml"}):
with unittest.mock.patch.dict(os.environ, {"DAF_BUTLER_REPOSITORY_INDEX": "file://not_found/x.yaml"}):
with self.assertRaises(FileNotFoundError):
Butler.get_repo_uri("label")
self.assertEqual(Butler.get_known_repos(), set())
Expand Down

0 comments on commit a4b0579

Please sign in to comment.