Light Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3cc82b4

Browse files
committed
Bring back providers compatibility checks
The compatibility checks were removed in #52072 accidentally. This one brings them back: * Python 3.10 * do not add cloudant (it was not working for Python 3.9)
1 parent bbe711e commit 3cc82b4

File tree

4 files changed

+39
-11
lines changed
  • dev/breeze/src/airflow_breeze
    • global_constants.py
  • providers/google/tests/unit/google/cloud/operators
    • test_bigquery_dts.py
    • test_datacatalog.py
    • test_functions.py

4 files changed

+39
-11
lines changed

dev/breeze/src/airflow_breeze/global_constants.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,26 @@ def generate_provider_dependencies_if_needed():
732732
# END OF EXTRAS LIST UPDATED BY PRE COMMIT
733733
]
734734

735-
PROVIDERS_COMPATIBILITY_TESTS_MATRIX: list[dict[str, str | list[str]]] = []
735+
PROVIDERS_COMPATIBILITY_TESTS_MATRIX: list[dict[str, str | list[str]]] = [
736+
{
737+
"python-version": "3.10",
738+
"airflow-version": "2.10.5",
739+
"remove-providers": "common.messaging fab git keycloak",
740+
"run-tests": "true",
741+
},
742+
{
743+
"python-version": "3.10",
744+
"airflow-version": "2.11.0",
745+
"remove-providers": "common.messaging fab git keycloak",
746+
"run-tests": "true",
747+
},
748+
{
749+
"python-version": "3.10",
750+
"airflow-version": "3.0.2",
751+
"remove-providers": "",
752+
"run-tests": "true",
753+
},
754+
]
736755

737756
# Number of slices for low dep tests
738757
NUMBER_OF_LOW_DEP_SLICES = 5

providers/google/tests/unit/google/cloud/operators/test_bigquery_dts.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
BigQueryDeleteDataTransferConfigOperator,
3030
)
3131

32-
from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
33-
3432
PROJECT_ID = "id"
3533

3634
TRANSFER_CONFIG = {
@@ -73,10 +71,7 @@ def test_execute(self, mock_hook):
7371
retry=DEFAULT,
7472
timeout=None,
7573
)
76-
if AIRFLOW_V_3_0_PLUS:
77-
ti.xcom_push.assert_called_with(key="transfer_config_id", value="1a2b3c")
78-
else:
79-
ti.xcom_push.assert_called_with(key="transfer_config_id", value="1a2b3c", execution_date=None)
74+
ti.xcom_push.assert_called_with(key="transfer_config_id", value="1a2b3c")
8075

8176
assert "secret_access_key" not in return_value.get("params", {})
8277
assert "access_key_id" not in return_value.get("params", {})
@@ -131,10 +126,7 @@ def test_execute(self, mock_hook):
131126
retry=DEFAULT,
132127
timeout=None,
133128
)
134-
if AIRFLOW_V_3_0_PLUS:
135-
ti.xcom_push.assert_called_with(key="run_id", value="123")
136-
else:
137-
ti.xcom_push.assert_called_with(key="run_id", value="123", execution_date=None)
129+
ti.xcom_push.assert_called_with(key="run_id", value="123")
138130

139131
@mock.patch(
140132
f"{OPERATOR_MODULE_PATH}.BiqQueryDataTransferServiceHook",

providers/google/tests/unit/google/cloud/operators/test_datacatalog.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from google.protobuf.field_mask_pb2 import FieldMask
2828

2929
from airflow.exceptions import AirflowProviderDeprecationWarning
30+
from airflow.providers.apache.spark.version_compat import AIRFLOW_V_3_0_PLUS
3031
from airflow.providers.google.cloud.operators.datacatalog import (
3132
CloudDataCatalogCreateEntryGroupOperator,
3233
CloudDataCatalogCreateEntryOperator,
@@ -163,6 +164,8 @@ def test_assert_valid_hook_call(self, mock_hook) -> None:
163164
)
164165
mock_ti = mock.MagicMock()
165166
mock_context = {"ti": mock_ti}
167+
if not AIRFLOW_V_3_0_PLUS:
168+
mock_context["task"] = task # type: ignore[assignment]
166169
result = task.execute(context=mock_context) # type: ignore[arg-type]
167170
mock_hook.assert_called_once_with(
168171
gcp_conn_id=TEST_GCP_CONN_ID,
@@ -205,6 +208,8 @@ def test_assert_valid_hook_call_when_exists(self, mock_hook) -> None:
205208
)
206209
mock_ti = mock.MagicMock()
207210
mock_context = {"ti": mock_ti}
211+
if not AIRFLOW_V_3_0_PLUS:
212+
mock_context["task"] = task # type: ignore[assignment]
208213
result = task.execute(context=mock_context) # type: ignore[arg-type]
209214
mock_hook.assert_called_once_with(
210215
gcp_conn_id=TEST_GCP_CONN_ID,
@@ -257,6 +262,8 @@ def test_assert_valid_hook_call(self, mock_hook) -> None:
257262
)
258263
mock_ti = mock.MagicMock()
259264
mock_context = {"ti": mock_ti}
265+
if not AIRFLOW_V_3_0_PLUS:
266+
mock_context["task"] = task # type: ignore[assignment]
260267
result = task.execute(context=mock_context) # type: ignore[arg-type]
261268
mock_hook.assert_called_once_with(
262269
gcp_conn_id=TEST_GCP_CONN_ID,
@@ -301,6 +308,8 @@ def test_assert_valid_hook_call(self, mock_hook) -> None:
301308
)
302309
mock_ti = mock.MagicMock()
303310
mock_context = {"ti": mock_ti}
311+
if not AIRFLOW_V_3_0_PLUS:
312+
mock_context["task"] = task # type: ignore[assignment]
304313
result = task.execute(context=mock_context) # type: ignore[arg-type]
305314
mock_hook.assert_called_once_with(
306315
gcp_conn_id=TEST_GCP_CONN_ID,
@@ -345,6 +354,8 @@ def test_assert_valid_hook_call(self, mock_hook) -> None:
345354
)
346355
mock_ti = mock.MagicMock()
347356
mock_context = {"ti": mock_ti}
357+
if not AIRFLOW_V_3_0_PLUS:
358+
mock_context["task"] = task # type: ignore[assignment]
348359
result = task.execute(context=mock_context) # type: ignore[arg-type]
349360
mock_hook.assert_called_once_with(
350361
gcp_conn_id=TEST_GCP_CONN_ID,
@@ -388,6 +399,8 @@ def test_assert_valid_hook_call(self, mock_hook) -> None:
388399
)
389400
mock_ti = mock.MagicMock()
390401
mock_context = {"ti": mock_ti}
402+
if not AIRFLOW_V_3_0_PLUS:
403+
mock_context["task"] = task # type: ignore[assignment]
391404
result = task.execute(context=mock_context) # type: ignore[arg-type]
392405
mock_hook.assert_called_once_with(
393406
gcp_conn_id=TEST_GCP_CONN_ID,

providers/google/tests/unit/google/cloud/operators/test_functions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
)
3333
from airflow.version import version
3434

35+
from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS
36+
3537
EMPTY_CONTENT = b""
3638
MOCK_RESP_404 = httplib2.Response({"status": 404})
3739

@@ -716,6 +718,8 @@ def test_execute(self, mock_gcf_hook):
716718
)
717719
mock_ti = mock.MagicMock()
718720
mock_context = {"ti": mock_ti}
721+
if not AIRFLOW_V_3_0_PLUS:
722+
mock_context["task"] = op
719723
op.execute(mock_context)
720724

721725
mock_gcf_hook.assert_called_once_with(

0 commit comments

Comments
(0)