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 d3b278daec Resolve teradata deprecations in tests (#39926)
d3b278daec is described below

commit d3b278daecf184fa3aea1c11c9d6f257b42862f9
Author: Gopal Dirisala <[email protected]>
AuthorDate: Thu May 30 11:58:47 2024 +0530

    Resolve teradata deprecations in tests (#39926)
---
 tests/deprecations_ignore.yml                   |  4 ----
 tests/providers/teradata/hooks/test_teradata.py | 24 ++++++++++++++++++++----
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/tests/deprecations_ignore.yml b/tests/deprecations_ignore.yml
index d6400074e6..8fc84755fd 100644
--- a/tests/deprecations_ignore.yml
+++ b/tests/deprecations_ignore.yml
@@ -682,10 +682,6 @@
 - 
tests/providers/ssh/hooks/test_ssh.py::TestSSHHook::test_tunnel_without_password
 - 
tests/providers/tableau/hooks/test_tableau.py::TestTableauHook::test_get_conn_auth_via_token_and_site_in_init
 - 
tests/providers/tableau/hooks/test_tableau.py::TestTableauHook::test_get_conn_ssl_default
-- 
tests/providers/teradata/hooks/test_teradata.py::TestTeradataHook::test_bulk_insert_rows_with_fields
-- 
tests/providers/teradata/hooks/test_teradata.py::TestTeradataHook::test_bulk_insert_rows_with_commit_every
-- 
tests/providers/teradata/hooks/test_teradata.py::TestTeradataHook::test_bulk_insert_rows_without_fields
-- 
tests/providers/teradata/hooks/test_teradata.py::TestTeradataHook::test_bulk_insert_rows_no_rows
 - 
tests/providers/trino/operators/test_trino.py::test_execute_openlineage_events
 - 
tests/providers/weaviate/operators/test_weaviate.py::TestWeaviateIngestOperator::test_constructor
 - 
tests/providers/weaviate/operators/test_weaviate.py::TestWeaviateIngestOperator::test_execute_with_input_json
diff --git a/tests/providers/teradata/hooks/test_teradata.py 
b/tests/providers/teradata/hooks/test_teradata.py
index 689ab871d9..f5bfdd59ad 100644
--- a/tests/providers/teradata/hooks/test_teradata.py
+++ b/tests/providers/teradata/hooks/test_teradata.py
@@ -23,6 +23,7 @@ from unittest import mock
 
 import pytest
 
+from airflow.exceptions import AirflowProviderDeprecationWarning
 from airflow.models import Connection
 from airflow.providers.teradata.hooks.teradata import TeradataHook
 
@@ -234,7 +235,11 @@ class TestTeradataHook:
     def test_bulk_insert_rows_with_fields(self):
         rows = [(1, 2, 3), (4, 5, 6), (7, 8, 9)]
         target_fields = ["col1", "col2", "col3"]
-        self.test_db_hook.bulk_insert_rows("table", rows, target_fields)
+        with pytest.warns(
+            AirflowProviderDeprecationWarning,
+            match="bulk_insert_rows is deprecated. Please use the insert_rows 
method instead.",
+        ):
+            self.test_db_hook.bulk_insert_rows("table", rows, target_fields)
         self.cur.executemany.assert_called_once_with(
             "INSERT INTO table (col1, col2, col3) VALUES (?,?,?)",
             [("1", "2", "3"), ("4", "5", "6"), ("7", "8", "9")],
@@ -243,7 +248,11 @@ class TestTeradataHook:
     def test_bulk_insert_rows_with_commit_every(self):
         rows = [(1, 2, 3), (4, 5, 6), (7, 8, 9)]
         target_fields = ["col1", "col2", "col3"]
-        self.test_db_hook.bulk_insert_rows("table", rows, target_fields, 
commit_every=2)
+        with pytest.warns(
+            AirflowProviderDeprecationWarning,
+            match="bulk_insert_rows is deprecated. Please use the insert_rows 
method instead.",
+        ):
+            self.test_db_hook.bulk_insert_rows("table", rows, target_fields, 
commit_every=2)
         calls = [
             mock.call(
                 "INSERT INTO table (col1, col2, col3) VALUES (?,?,?)", [("1", 
"2", "3"), ("4", "5", "6")]
@@ -254,7 +263,11 @@ class TestTeradataHook:
 
     def test_bulk_insert_rows_without_fields(self):
         rows = [(1, 2, 3), (4, 5, 6), (7, 8, 9)]
-        self.test_db_hook.bulk_insert_rows("table", rows)
+        with pytest.warns(
+            AirflowProviderDeprecationWarning,
+            match="bulk_insert_rows is deprecated. Please use the insert_rows 
method instead.",
+        ):
+            self.test_db_hook.bulk_insert_rows("table", rows)
         self.cur.executemany.assert_called_once_with(
             "INSERT INTO table  VALUES (?,?,?)",
             [("1", "2", "3"), ("4", "5", "6"), ("7", "8", "9")],
@@ -262,7 +275,10 @@ class TestTeradataHook:
 
     def test_bulk_insert_rows_no_rows(self):
         rows = []
-        with pytest.raises(ValueError):
+        with pytest.raises(ValueError), pytest.warns(
+            AirflowProviderDeprecationWarning,
+            match="bulk_insert_rows is deprecated. Please use the insert_rows 
method instead.",
+        ):
             self.test_db_hook.bulk_insert_rows("table", rows)
 
     def test_callproc_dict(self):

Reply via email to