Skip to content

Commit

Permalink
Merge pull request #938 from lsst/tickets/DM-42416
Browse files Browse the repository at this point in the history
DM-42416: Modify without_datastore test to use file config
  • Loading branch information
timj authored Jan 9, 2024
2 parents 307ac87 + 550f2e0 commit d8d7886
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 d8d7886

Please sign in to comment.