ashb commented on a change in pull request #21641:
URL: https://github.com/apache/airflow/pull/21641#discussion_r811195531
##########
File path: airflow/models/mappedoperator.py
##########
@@ -245,16 +296,13 @@ def _validate_argument_count(self) -> None:
"""
if isinstance(self.operator_class, str):
return # No need to validate deserialized operator.
- operator = self._create_unmapped_operator(
- mapped_kwargs={k: unittest.mock.MagicMock(name=k) for k in
self.mapped_kwargs},
- partial_kwargs=self.partial_kwargs,
- real=False,
- )
- if operator.task_group:
- operator.task_group._remove(operator)
- dag = operator.get_dag()
+ mocked_mapped_kwargs = create_mocked_kwargs(self.mapped_kwargs)
+ op =
self._create_unmapped_operator(mapped_kwargs=mocked_mapped_kwargs, real=False)
Review comment:
Yeah, I was thinking an escape hatch for when an Operator ctor does
something that causes it to fail when given a Mock.
A proper class-level `validate(**kwargs)` sounds like a better idea.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]