This is an automated email from the ASF dual-hosted git repository.
eladkal 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 dd7fa8aa68 Resolve mssql deprecations in tests (#40433)
dd7fa8aa68 is described below
commit dd7fa8aa6849b52894d49efda3a15b13e881b2bf
Author: Gopal Dirisala <[email protected]>
AuthorDate: Thu Jun 27 09:14:21 2024 +0530
Resolve mssql deprecations in tests (#40433)
---
tests/deprecations_ignore.yml | 2 --
tests/providers/microsoft/mssql/operators/test_mssql.py | 8 +++++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/deprecations_ignore.yml b/tests/deprecations_ignore.yml
index 1c876b2f61..aa3fa055bc 100644
--- a/tests/deprecations_ignore.yml
+++ b/tests/deprecations_ignore.yml
@@ -224,7 +224,5 @@
-
tests/providers/google/cloud/transfers/test_gcs_to_gcs.py::TestGoogleCloudStorageToCloudStorageOperator::test_wc_with_last_modified_time_with_one_true_cond
-
tests/providers/google/cloud/transfers/test_gcs_to_gcs.py::TestGoogleCloudStorageToCloudStorageOperator::test_wc_with_no_last_modified_time
-
tests/providers/microsoft/azure/hooks/test_adx.py::TestAzureDataExplorerHook::test_backcompat_prefix_works
--
tests/providers/microsoft/mssql/operators/test_mssql.py::TestMsSqlOperator::test_get_hook_default
--
tests/providers/microsoft/mssql/operators/test_mssql.py::TestMsSqlOperator::test_get_hook_from_conn
-
tests/providers/microsoft/psrp/hooks/test_psrp.py::TestPsrpHook::test_invoke_cmdlet_deprecated_kwargs
-
tests/providers/trino/operators/test_trino.py::test_execute_openlineage_events
diff --git a/tests/providers/microsoft/mssql/operators/test_mssql.py
b/tests/providers/microsoft/mssql/operators/test_mssql.py
index 819faf42c8..8f2311ec76 100644
--- a/tests/providers/microsoft/mssql/operators/test_mssql.py
+++ b/tests/providers/microsoft/mssql/operators/test_mssql.py
@@ -23,13 +23,15 @@ from unittest.mock import MagicMock, Mock
import pytest
from airflow.exceptions import AirflowException
+from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator
try:
from airflow.providers.microsoft.mssql.hooks.mssql import MsSqlHook
- from airflow.providers.microsoft.mssql.operators.mssql import MsSqlOperator
except ImportError:
pytest.skip("MSSQL not available", allow_module_level=True)
+MSSQL_DEFAULT = "mssql_default"
+
class TestMsSqlOperator:
@mock.patch("airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator.get_db_hook")
@@ -46,7 +48,7 @@ class TestMsSqlOperator:
mock_hook = MagicMock()
mock_get_db_hook.return_value = mock_hook
- op = MsSqlOperator(task_id="test", sql="")
+ op = SQLExecuteQueryOperator(task_id="test", sql="",
conn_id=MSSQL_DEFAULT)
assert op.get_db_hook() == mock_hook
@mock.patch(
@@ -59,5 +61,5 @@ class TestMsSqlOperator:
"""
mock_get_db_hook.return_value.side_effect =
Mock(side_effect=AirflowException())
- op = MsSqlOperator(task_id="test", sql="")
+ op = SQLExecuteQueryOperator(task_id="test", sql="",
conn_id=MSSQL_DEFAULT)
assert op.get_db_hook().__class__.__name__ == "MsSqlHook"