Skip to content

Commit

Permalink
Check for Task metadata inputs in mocking system.
Browse files Browse the repository at this point in the history
  • Loading branch information
TallJimbo committed Aug 1, 2024
1 parent d909c49 commit 36fc00e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/changes/DM-45536.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix support for task metadata as inputs in the `PipelineTask` mocking system.
5 changes: 5 additions & 0 deletions python/lsst/pipe/base/tests/mocks/_pipeline_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Check warning on line 432 in python/lsst/pipe/base/tests/mocks/_pipeline_task.py

View check run for this annotation

Codecov / codecov/patch

python/lsst/pipe/base/tests/mocks/_pipeline_task.py#L432

Added line #L432 was not covered by tests
setattr(self, name, connection)

def getSpatialBoundsConnections(self) -> Iterable[str]:
Expand Down

0 comments on commit 36fc00e

Please sign in to comment.