This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new fabe74d37d4 Fix no-op assertion in MaxCompute run_sql test (#69406)
fabe74d37d4 is described below
commit fabe74d37d463375244deb208f2ec88a8125b921
Author: Anas Khan <[email protected]>
AuthorDate: Sat Aug 1 00:34:00 2026 +0530
Fix no-op assertion in MaxCompute run_sql test (#69406)
---
.../tests/unit/alibaba/cloud/hooks/test_maxcompute.py | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git
a/providers/alibaba/tests/unit/alibaba/cloud/hooks/test_maxcompute.py
b/providers/alibaba/tests/unit/alibaba/cloud/hooks/test_maxcompute.py
index f5a1e59c639..0ecd8c8527f 100644
--- a/providers/alibaba/tests/unit/alibaba/cloud/hooks/test_maxcompute.py
+++ b/providers/alibaba/tests/unit/alibaba/cloud/hooks/test_maxcompute.py
@@ -19,6 +19,8 @@ from __future__ import annotations
from unittest import mock
+import pytest
+
from airflow.providers.alibaba.cloud.hooks.maxcompute import MaxComputeHook
MAXCOMPUTE_HOOK_MODULE =
"airflow.providers.alibaba.cloud.hooks.maxcompute.MaxComputeHook.{}"
@@ -43,17 +45,23 @@ class TestMaxComputeHook:
mock_get_connection.return_value = mock_conn
self.hook =
MaxComputeHook(maxcompute_conn_id=MOCK_MAXCOMPUTE_CONN_ID)
+ @pytest.mark.parametrize(
+ ("priority", "hints", "expected_priority"),
+ [
+ pytest.param(1, {"hint_key": "hint_value"}, 1,
id="explicit-priority"),
+ pytest.param(None, {"odps.instance.priority": 5}, 5,
id="priority-from-hints"),
+ pytest.param(None, None, None, id="no-priority"),
+ ],
+ )
@mock.patch(MAXCOMPUTE_HOOK_MODULE.format("get_client"))
- def test_run_sql(self, mock_get_client):
+ def test_run_sql(self, mock_get_client, priority, hints,
expected_priority):
mock_instance = mock.MagicMock()
mock_client = mock.MagicMock()
mock_client.run_sql.return_value = mock_instance
mock_get_client.return_value = mock_client
sql = "SELECT 1"
- priority = 1
running_cluster = "mock_running_cluster"
- hints = {"hint_key": "hint_value"}
aliases = {"alias_key": "alias_value"}
default_schema = "mock_default_schema"
quota_name = "mock_quota_name"
@@ -70,9 +78,9 @@ class TestMaxComputeHook:
assert instance == mock_instance
- assert mock_client.run_sql.asssert_called_once_with(
+ mock_client.run_sql.assert_called_once_with(
sql=sql,
- priority=priority,
+ priority=expected_priority,
running_cluster=running_cluster,
hints=hints,
aliases=aliases,