TemporaryButler#

class lsst.images.tests.TemporaryButler(run: str = 'test_run', *, format: str | None = None, recipe: str | None = None, **kwargs: str)#

Bases: object

Make a temporary butler repository.

Parameters#

run

Name of a RUN collection to register and use as the default run for the returned butler.

format

Optional on-disk format name (fits, json, sdf, zarr, …) to bind to every storage class registered by **kwargs. When set, the datastore config is overlaid so that GenericFormatter writes that format for those storage classes, overriding its .fits default. Leave as None to keep the default formatter behaviour.

recipe

Optional write recipe to bind to every storage class registered by **kwargs.

**kwargs

A mapping from a dataset type name to its storage class. For each entry, a dataset type will be registered with empty dimensions, and a DatasetRef will be created and added as an attribute of this class.

Raises#

unittest.SkipTest

Raised when the context manager is entered if lsst.daf.butler could not be imported. This is typically handled by using this context manager within a unittest.TestCase.subTest context, which will skip just the butler-required tests in that context while allowing the rest of the test to continue.