Skip to content

Commit

Permalink
Don't assume storage classes are mocked because dataset type name is.
Browse files Browse the repository at this point in the history
Automatic-output connections (configs, logs, metadata) get _mock
prefixes from the task label, but don't actually use mock storage
classes.
  • Loading branch information
TallJimbo committed Oct 16, 2023
1 parent b8f0569 commit c250564
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions python/lsst/pipe/base/tests/mocks/_storage_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,16 +405,18 @@ def unmock_dataset_type(mock_type: DatasetType) -> DatasetType:
original_type : `lsst.daf.butler.DatasetType`
The original dataset type.
"""
mock_storage_class = cast(MockStorageClass, mock_type.storageClass)
original_parent_storage_class = None
if mock_type.parentStorageClass is not None:
original_parent_storage_class = cast(MockStorageClass, mock_type.parentStorageClass).original
storage_class = mock_type.storageClass
parent_storage_class = mock_type.parentStorageClass
if isinstance(storage_class, MockStorageClass):
storage_class = storage_class.original
if parent_storage_class is not None and isinstance(parent_storage_class, MockStorageClass):
parent_storage_class = parent_storage_class.original
return DatasetType(
get_original_name(mock_type.name),
mock_type.dimensions,
mock_storage_class.original,
storage_class,
isCalibration=mock_type.isCalibration(),
parentStorageClass=original_parent_storage_class,
parentStorageClass=parent_storage_class,
)

@staticmethod
Expand Down

0 comments on commit c250564

Please sign in to comment.