Skip to content

Commit 56ad7ef

Browse files
tchatonlexierule
authored andcommitted
fix unwrap Work run
1 parent c3ceac8 commit 56ad7ef

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lightning_app/utilities/app_helpers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,18 @@ def is_overridden(method_name: str, instance: Optional[object] = None, parent: O
247247
instance_attr = getattr(instance, method_name, None)
248248
if instance_attr is None:
249249
return False
250+
250251
# `Mock(wraps=...)` support
251252
if isinstance(instance_attr, Mock):
252253
# access the wrapped function
253254
instance_attr = instance_attr._mock_wraps
255+
254256
if instance_attr is None:
255257
return False
256258

259+
if hasattr(instance_attr, "__wrapped__"):
260+
instance_attr = instance_attr.__wrapped__
261+
257262
parent_attr = getattr(parent, method_name, None)
258263
if parent_attr is None:
259264
raise ValueError("The parent should define the method")

0 commit comments

Comments
 (0)