Skip to content

Commit

Permalink
Merge pull request #87 from lsst/tickets/DM-41235
Browse files Browse the repository at this point in the history
DM-41235: Update test to use Butler factory method
  • Loading branch information
andy-slac authored Oct 26, 2023
2 parents d708d77 + 1870638 commit 051464e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions tests/test_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import unittest
from typing import Any

from lsst.daf.butler import Butler, ButlerConfig, Registry, RegistryConfig
from lsst.daf.butler import Butler, Config
from lsst.daf.butler.tests import DatastoreMock
from lsst.daf.butler.tests.utils import makeTestTempDir, removeTestTempDir
from lsst.pipe.base.tests.pipelineStepTester import PipelineStepTester
Expand Down Expand Up @@ -165,18 +165,13 @@ def tearDown(self):

def makeButler(self, **kwargs: Any) -> Butler:
"""Return new Butler instance on each call."""
config = ButlerConfig()
config = Config()

# make separate temporary directory for registry of this instance
tmpdir = tempfile.mkdtemp(dir=self.root)
config["registry", "db"] = f"sqlite:///{tmpdir}/gen3.sqlite3"
config["root"] = self.root

# have to make a registry first
registryConfig = RegistryConfig(config.get("registry"))
Registry.createFromConfig(registryConfig)

butler = Butler(config, **kwargs)
config = Butler.makeRepo(self.root, config)
butler = Butler.from_config(config, **kwargs)
DatastoreMock.apply(butler)
return butler

Expand Down

0 comments on commit 051464e

Please sign in to comment.