uranusjr commented on a change in pull request #21641:
URL: https://github.com/apache/airflow/pull/21641#discussion_r810680512
##########
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:
Escape hatch for if an operator cannot correctly run `__init__` with
mocks?
I think eventually we may want to create a separate API for validation
without actually creating the operator, perhaps a classmethod called `validate`
that can be called here.
--
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]