ashb commented on code in PR #49554:
URL: https://github.com/apache/airflow/pull/49554#discussion_r2054157789
##########
providers/standard/tests/unit/standard/operators/test_latest_only_operator.py:
##########
@@ -164,78 +164,47 @@ def test_skipping_non_latest(self, dag_maker):
latest_ti2 = dr2.get_task_instance(task_id="latest")
latest_ti2.task = latest_task
latest_ti2.run()
-
- latest_ti2.set_state(State.SUCCESS)
-
- # Verify the state of the other downstream tasks
- downstream_task.run(start_date=DEFAULT_DATE, end_date=END_DATE)
- downstream_task2.run(start_date=DEFAULT_DATE, end_date=END_DATE)
- downstream_task3.run(start_date=DEFAULT_DATE, end_date=END_DATE)
-
- downstream_instances = get_task_instances("downstream")
- exec_date_to_downstream_state = {ti.logical_date: ti.state for ti
in downstream_instances}
- assert exec_date_to_downstream_state == {
- timezone.datetime(2016, 1, 1): "skipped",
- timezone.datetime(2016, 1, 1, 12): "skipped",
- timezone.datetime(2016, 1, 2): "success",
- }
-
- downstream_instances = get_task_instances("downstream_2")
- exec_date_to_downstream_state = {ti.logical_date: ti.state for ti
in downstream_instances}
- assert exec_date_to_downstream_state == {
- timezone.datetime(2016, 1, 1): None,
- timezone.datetime(2016, 1, 1, 12): None,
- timezone.datetime(2016, 1, 2): "success",
- }
-
- downstream_instances = get_task_instances("downstream_3")
- exec_date_to_downstream_state = {ti.logical_date: ti.state for ti
in downstream_instances}
- assert exec_date_to_downstream_state == {
- timezone.datetime(2016, 1, 1): "success",
- timezone.datetime(2016, 1, 1, 12): "success",
- timezone.datetime(2016, 1, 2): "success",
- }
-
else:
latest_task.run(start_date=DEFAULT_DATE, end_date=END_DATE)
- downstream_task.run(start_date=DEFAULT_DATE, end_date=END_DATE)
- downstream_task2.run(start_date=DEFAULT_DATE, end_date=END_DATE)
- downstream_task3.run(start_date=DEFAULT_DATE, end_date=END_DATE)
+ latest_instances = get_task_instances("latest")
+ exec_date_to_latest_state = {ti.logical_date: ti.state for ti in
latest_instances}
+ assert exec_date_to_latest_state == {
+ timezone.datetime(2016, 1, 1): "success",
+ timezone.datetime(2016, 1, 1, 12): "success",
+ timezone.datetime(2016, 1, 2): "success",
+ }
- latest_instances = get_task_instances("latest")
Review Comment:
All of these changes in the tests are to reduce the differences between v2
and v3 -- it should behave the same.
Best viewed in "split mode"
--
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]