moomindani commented on code in PR #69998:
URL: https://github.com/apache/airflow/pull/69998#discussion_r3877530721
##########
providers/databricks/tests/unit/databricks/plugins/test_databricks_workflow.py:
##########
@@ -251,21 +257,58 @@ def
test_workflow_job_repair_single_failed_link_airflow2():
ti_key.run_id = "run_id"
ti_key.try_number = 1
- with patch(
-
"airflow.providers.databricks.plugins.databricks_workflow.get_task_instance"
- ) as mock_get_task_instance:
- with patch(
+ with (
+ patch(
+
"airflow.providers.databricks.plugins.databricks_workflow.get_task_instance"
+ ) as mock_get_task_instance,
+ patch(
"airflow.providers.databricks.plugins.databricks_workflow.get_xcom_result"
- ) as mock_get_xcom_result:
- with patch(
-
"airflow.providers.databricks.plugins.databricks_workflow.DagBag.get_dag"
- ) as mock_get_dag:
- mock_get_task_instance.return_value = Mock(key=ti_key)
- mock_get_xcom_result.return_value =
Mock(conn_id="conn_id", run_id=1)
- mock_get_dag.return_value.get_task =
Mock(return_value=Mock(task_id="task_id"))
+ ) as mock_get_xcom_result,
+
patch("airflow.providers.databricks.plugins.databricks_workflow.DagBag.get_dag")
as mock_get_dag,
+ ):
+ mock_get_task_instance.return_value = Mock(key=ti_key)
+ mock_get_xcom_result.return_value = Mock(conn_id="conn_id",
run_id=1)
+ mock_get_dag.return_value.get_task =
Mock(return_value=Mock(task_id="task_id"))
- result = link.get_link(operator, ti_key=ti_key)
- assert
result.startswith("http://localhost/repair_databricks_job")
+ result = link.get_link(operator, ti_key=ti_key)
+ assert result.startswith("http://localhost/repair_databricks_job")
+
+
[email protected](AIRFLOW_V_3_0_PLUS, reason="Test only for Airflow < 3.0")
[email protected](
+ RUNNING_TESTS_AGAINST_AIRFLOW_PACKAGES, reason="Web plugin test doesn't
work when not against sources"
+)
Review Comment:
Worth knowing that this test never runs, in CI or locally: the two guards
cover every environment between them.
`RUNNING_TESTS_AGAINST_AIRFLOW_PACKAGES` is `True` whenever
`USE_AIRFLOW_VERSION` is set *or* `<repo root>/airflow/__init__.py` is missing
(`devel-common/src/tests_common/__init__.py:27`) — and in the monorepo layout
that file no longer exists, so the constant is `True` even on a sources
checkout. In the Airflow 2.11 compatibility job the first clause makes it
`True` as well, and on Airflow 3 sources `AIRFLOW_V_3_0_PLUS` skips it first.
Measured here: the whole `airflow2` selection reports `11 skipped`, this test
among them.
That is structural rather than a defect in this PR — the legacy branch's
helpers (`_get_dag`, `_get_dagrun`, the FAB views) are defined inside `if not
AIRFLOW_V_3_0_PLUS:`, so nothing in the 2.x path can be exercised from an
Airflow 3 checkout, and the neighbouring `*_airflow2` tests sit in the same
position. No change requested. I am noting it so nobody later reads this test
as a live regression guard for the fix.
--
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]