Skip to content

Commit

Permalink
Fix unit test that was looking for the wrong behavior.
Browse files Browse the repository at this point in the history
First problem was just that the test assumed it could register a
dataset type after the QG was made and not run into trouble when
running that QG.

Second problem was that it was just expecting something other than what
its own code comments suggested, which was also contrary to correct
behavior.
  • Loading branch information
TallJimbo committed Dec 1, 2023
1 parent dd2f147 commit ae2ae85
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions tests/test_simple_pipeline_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,6 @@ def test_from_pipeline_intermediates_differ(self):

def test_from_pipeline_output_differ(self):
"""Run pipeline but output definition in registry differs."""
executor = self._configure_pipeline(
NoDimensionsTestTask.ConfigClass,
NoDimensionsTestTask.ConfigClass,
storageClass_a="TaskMetadataLike",
)

# Pre-define the "output" storage class to be something that is
# like a dict but is not a dict. This will fail unless storage
# class conversion is supported in put and get.
Expand All @@ -243,14 +237,21 @@ def test_from_pipeline_output_differ(self):
)
)

executor = self._configure_pipeline(
NoDimensionsTestTask.ConfigClass,
NoDimensionsTestTask.ConfigClass,
storageClass_a="TaskMetadataLike",
)

with self.assertLogs("lsst", level="INFO") as cm:
quanta = executor.run(register_dataset_types=True, save_versions=False)
# a has been told to return a TaskMetadata but will convert to dict.
# a has been told to return a TaskMetadata but this will convert to
# dict on read by b.
# b returns a dict and that is converted to TaskMetadata on put.
self._test_logs(cm.output, "dict", "lsst.pipe.base.TaskMetadata", "dict", "dict")

self.assertEqual(len(quanta), 2)
self.assertEqual(self.butler.get("intermediate"), {"zero": 0, "one": 1})
self.assertEqual(self.butler.get("intermediate").to_dict(), {"zero": 0, "one": 1})
self.assertEqual(self.butler.get("output").to_dict(), {"zero": 0, "one": 1, "two": 2})

def test_from_pipeline_input_differ(self):
Expand Down

0 comments on commit ae2ae85

Please sign in to comment.