From 36fc00eabc156097b19743ef52cc12ce0d97a4cb Mon Sep 17 00:00:00 2001 From: Jim Bosch Date: Thu, 1 Aug 2024 14:09:42 -0400 Subject: [PATCH] Check for Task metadata inputs in mocking system. --- doc/changes/DM-45536.bugfix.md | 1 + python/lsst/pipe/base/tests/mocks/_pipeline_task.py | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 doc/changes/DM-45536.bugfix.md diff --git a/doc/changes/DM-45536.bugfix.md b/doc/changes/DM-45536.bugfix.md new file mode 100644 index 00000000..6624dcd8 --- /dev/null +++ b/doc/changes/DM-45536.bugfix.md @@ -0,0 +1 @@ +Fix support for task metadata as inputs in the `PipelineTask` mocking system. diff --git a/python/lsst/pipe/base/tests/mocks/_pipeline_task.py b/python/lsst/pipe/base/tests/mocks/_pipeline_task.py index e191e3b1..c8bdda9b 100644 --- a/python/lsst/pipe/base/tests/mocks/_pipeline_task.py +++ b/python/lsst/pipe/base/tests/mocks/_pipeline_task.py @@ -425,6 +425,11 @@ def __init__(self, *, config: MockPipelineTaskConfig): raise ValueError( f"Unmocked dataset type {connection.name!r} cannot be used as an init-output." ) + elif connection.name.endswith("_metadata") and connection.storageClass == "TaskMetadata": + # Task metadata does not use a mock storage class, because it's + # written by the system, but it does end up with the _mock_* + # prefix because the task label does. + connection = dataclasses.replace(connection, name=get_mock_name(connection.name)) setattr(self, name, connection) def getSpatialBoundsConnections(self) -> Iterable[str]: