Skip to content

Commit

Permalink
Modify without_datastore test to use file config
Browse files Browse the repository at this point in the history
In w.2023.50 the test passed because the config was sent
as a Config object, but would fail if a path to a Config was
used instead. Rewrite the test to use a file (which works now
due to a later reorganization).
  • Loading branch information
timj committed Jan 9, 2024
1 parent 307ac87 commit 550f2e0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/test_butler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2397,13 +2397,18 @@ def tearDown(self) -> None:

def test_fallback(self) -> None:
# Read the butler config and mess with the datastore section.
bad_config = Config(os.path.join(self.root, "butler.yaml"))
config_path = os.path.join(self.root, "butler.yaml")
bad_config = Config(config_path)
bad_config["datastore", "cls"] = "lsst.not.a.datastore.Datastore"
bad_config.dumpToUri(config_path)

with self.assertRaises(RuntimeError):
Butler.from_config(bad_config)
Butler(self.root, without_datastore=False)

butler = Butler.from_config(bad_config, writeable=True, without_datastore=True)
with self.assertRaises(RuntimeError):
Butler.from_config(self.root, without_datastore=False)

butler = Butler.from_config(self.root, writeable=True, without_datastore=True)
self.assertIsInstance(butler._datastore, NullDatastore)

# Check that registry is working.
Expand Down

0 comments on commit 550f2e0

Please sign in to comment.