makeTestRepo

lsst.daf.butler.tests.makeTestRepo(root: str, dataIds: Mapping[str, Iterable] | None = None, *, config: Config | None = None, **kwargs: Any) Butler

Create an empty test repository.

Parameters:
rootstr

The location of the root directory for the repository.

dataIdsMapping [str, iterable], optional

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, with values created for implied dimensions only when needed. This parameter is provided for compatibility with old code; newer code should make the repository, then call addDataIdValue.

configlsst.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. The defaults set .datastore.cls, .datastore.checksum and .registry.db. If a supplied config does not specify these values the internal defaults will be used to ensure that we have a usable configuration.

**kwargs

Extra arguments to lsst.daf.butler.Butler.makeRepo.

Returns:
butlerlsst.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. 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.