makeTestRepo¶
-
lsst.daf.butler.tests.
makeTestRepo
(root, dataIds, *, config=None, **kwargs)¶ Create an empty repository with dummy data IDs.
Parameters: - root :
str
The location of the root directory for the repository.
- dataIds :
Mapping
[str
,iterable
] A mapping keyed by the dimensions used in the test. Each value is an iterable of names for that dimension (e.g., detector IDs for
"detector"
). Related dimensions (e.g., instruments and detectors) are linked arbitrarily.- config :
lsst.daf.butler.Config
, optional A configuration for the repository (for details, see
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
.
Returns: - butler :
lsst.daf.butler.Butler
A Butler referring to the new repository. This Butler is provided only for additional setup; to keep test cases isolated, it is highly recommended that each test create its own Butler with a unique run/collection. See
makeTestCollection
.
Notes
This function provides a “quick and dirty” repository for simple unit tests that don’t depend on complex data relationships. Because it assigns dimension relationships and other metadata abitrarily, it is ill-suited for tests where the structure of the data matters. If you need such a dataset, create it directly or use a saved test dataset.
Since the values in
dataIds
uniquely determine the repository’s data IDs, the fully linked IDs can be recovered by callingexpandUniqueId
, so long as no other code has inserted dimensions into the repository registry.- root :