This is an automated email from the ASF dual-hosted git repository.

taragolis 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 f6098a46e2 Resolve deprecations in `slack` provider tests (#39518)
f6098a46e2 is described below

commit f6098a46e249ae4bbeb71ff35eb38005cc9b7a49
Author: Andrey Anshin <[email protected]>
AuthorDate: Thu May 9 21:11:57 2024 +0400

    Resolve deprecations in `slack` provider tests (#39518)
---
 tests/deprecations_ignore.yml                 |  1 -
 tests/providers/slack/operators/test_slack.py | 17 +++++++++++------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/tests/deprecations_ignore.yml b/tests/deprecations_ignore.yml
index 87bc17a612..21fd16584c 100644
--- a/tests/deprecations_ignore.yml
+++ b/tests/deprecations_ignore.yml
@@ -668,7 +668,6 @@
 - 
tests/providers/sftp/operators/test_sftp.py::TestSFTPOperator::test_json_file_transfer_put
 - 
tests/providers/sftp/operators/test_sftp.py::TestSFTPOperator::test_pickle_file_transfer_get
 - 
tests/providers/sftp/operators/test_sftp.py::TestSFTPOperator::test_pickle_file_transfer_put
-- 
tests/providers/slack/operators/test_slack.py::TestSlackAPIFileOperator::test_both_channel_and_channels_set
 - 
tests/providers/snowflake/operators/test_snowflake.py::TestSnowflakeOperator::test_snowflake_operator
 - 
tests/providers/snowflake/operators/test_snowflake.py::TestSnowflakeOperatorForParams::test_overwrite_params
 - tests/providers/snowflake/operators/test_snowflake_sql.py::test_exec_success
diff --git a/tests/providers/slack/operators/test_slack.py 
b/tests/providers/slack/operators/test_slack.py
index ce9a96a066..603cef7835 100644
--- a/tests/providers/slack/operators/test_slack.py
+++ b/tests/providers/slack/operators/test_slack.py
@@ -302,13 +302,18 @@ class TestSlackAPIFileOperator:
 
     def test_both_channel_and_channels_set(self):
         error_message = r"Cannot set both arguments: channel=.* and 
channels=.*\."
+        warning_message = (
+            r"Argument `channel` is deprecated and will removed in a future 
releases\. "
+            r"Please use `channels` instead\."
+        )
         with pytest.raises(ValueError, match=error_message):
-            SlackAPIFileOperator(
-                task_id="slack",
-                slack_conn_id=SLACK_API_TEST_CONNECTION_ID,
-                channel="#random",
-                channels="#general",
-            )
+            with pytest.warns(AirflowProviderDeprecationWarning, 
match=warning_message):
+                SlackAPIFileOperator(
+                    task_id="slack",
+                    slack_conn_id=SLACK_API_TEST_CONNECTION_ID,
+                    channel="#random",
+                    channels="#general",
+                )
 
     @pytest.mark.db_test
     @pytest.mark.parametrize(

Reply via email to