Skip to content

Commit

Permalink
Make makeTestRepo use an in-memory repository by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
kfindeisen committed Feb 4, 2020
1 parent 4420ff2 commit f7ebf5a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions python/lsst/daf/butler/tests/_testRepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import numpy as np

from lsst.daf.butler import Butler, DatasetType
from lsst.daf.butler import Butler, Config, DatasetType


def makeTestRepo(root, dataIds, *, config=None, **kwargs):
Expand All @@ -42,8 +42,8 @@ def makeTestRepo(root, dataIds, *, config=None, **kwargs):
are linked arbitrarily.
config : `lsst.daf.butler.Config`, optional
A configuration for the repository (for details, see
`lsst.daf.butler.Butler.makeRepo`). If omitted, uses the
default config.
`lsst.daf.butler.Butler.makeRepo`). If omitted, creates a repository
with default dataset and storage types, but optimized for speed.
**kwargs
Extra arguments to `lsst.daf.butler.Butler.makeRepo`.
Expand All @@ -62,6 +62,11 @@ def makeTestRepo(root, dataIds, *, config=None, **kwargs):
`expandUniqueId`, so long as no other code has inserted dimensions into
the repository registry.
"""
if not config:
config = Config()
config[".datastore.cls"] = "lsst.daf.butler.datastores.inMemoryDatastore.InMemoryDatastore"
config[".datastore.checksum"] = False # In case of future changes
config[".registry.db"] = "sqlite:///:memory:"
Butler.makeRepo(root, config=config, **kwargs)
butler = Butler(root, writeable=True)
dimensionRecords = _makeRecords(dataIds, butler.registry.dimensions)
Expand Down

0 comments on commit f7ebf5a

Please sign in to comment.