Dev-iL commented on code in PR #60810:
URL: https://github.com/apache/airflow/pull/60810#discussion_r2762650584
##########
providers/standard/tests/unit/standard/operators/test_trigger_dagrun.py:
##########
@@ -556,12 +556,18 @@ def test_trigger_dagrun(self, dag_maker,
mock_supervisor_comms):
"""Test TriggerDagRunOperator."""
with time_machine.travel("2025-02-18T08:04:46Z", tick=False):
with dag_maker(TEST_DAG_ID, default_args={"start_date":
DEFAULT_DATE}, serialized=True):
- task = TriggerDagRunOperator(task_id="test_task",
trigger_dag_id=TRIGGERED_DAG_ID)
+ task = TriggerDagRunOperator(
+ task_id="test_task", trigger_dag_id=TRIGGERED_DAG_ID,
note="Test note"
+ )
+ mock_warning = mock.patch.object(task.log, "warning").start()
dag_maker.sync_dagbag_to_db()
parse_and_sync_to_db(self.f_name)
dag_maker.create_dagrun()
task.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE,
ignore_ti_state=True)
+ mock_warning.assert_called_once_with(
Review Comment:
Can you please restructure this assertion to use the assert keyword? This
should look like:
```python
def test_trigger_dagrun(self, dag_maker, mock_supervisor_comms, mocker):
...
# If we want to assert that one of multiple calls was the right one:
assert mocker.call(...) in mock_warning.mock_calls
# If we want to assert there was exactly one call, and it was the
right one:
assert mock_warning.mock_calls == [mocker.call(...)]
# If we want to assert there were no calls:
assert mock_warning.mock_calls == []
```
See also: https://lists.apache.org/thread/41b04mg0rolv0sj98jhogsztstxnqfg5
--
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]