You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/02/18 07:30:18 UTC

[GitHub] [airflow] Khrol opened a new pull request #14289: Don't allow SlackHook accept *args

Khrol opened a new pull request #14289:
URL: https://github.com/apache/airflow/pull/14289


   Underlying Slack WebClient doesn't accept *args anymore
   
   <img width="482" alt="Screenshot 2021-02-18 at 09 06 33" src="https://user-images.githubusercontent.com/3982146/108320588-ad04ba00-71cb-11eb-9000-0fd946fd6f57.png">
   
   ```
   >>> from airflow.providers.slack.hooks.slack import SlackHook
   >>> alert = SlackHook('...')
   >>> alert.call('chat.postMessage', {'text': 'Igor is testing', 'channel': 'test-channel'})
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/Users/khroliz/.local/share/virtualenvs/parcel-vGquKnoL/lib/python3.8/site-packages/airflow/providers/slack/hooks/slack.py", line 103, in call
       self.client.api_call(api_method, *args, **kwargs)
   TypeError: api_call() takes 2 positional arguments but 3 were given
   >>> alert.call('chat.postMessage', data={'text': 'Igor is testing', 'channel': 'test-channel'})
   ```
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #14289: Don't allow SlackHook accept *args

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #14289:
URL: https://github.com/apache/airflow/pull/14289#issuecomment-781275282


   The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest master or amend the last commit of the PR, and push it with --force-with-lease.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek merged pull request #14289: Don't allow SlackHook accept *args

Posted by GitBox <gi...@apache.org>.
turbaszek merged pull request #14289:
URL: https://github.com/apache/airflow/pull/14289


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] turbaszek commented on a change in pull request #14289: Don't allow SlackHook accept *args

Posted by GitBox <gi...@apache.org>.
turbaszek commented on a change in pull request #14289:
URL: https://github.com/apache/airflow/pull/14289#discussion_r578385643



##########
File path: tests/providers/slack/hooks/test_slack.py
##########
@@ -120,7 +120,7 @@ def test_call_with_failure(self, slack_client_class_mock):
         test_api_params = {'key1': 'value1', 'key2': 'value2'}
 
         with pytest.raises(SlackApiError):
-            slack_hook.call(test_method, test_api_params)

Review comment:
       Out of curiosity - was this test working previously?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] Khrol commented on a change in pull request #14289: Don't allow SlackHook accept *args

Posted by GitBox <gi...@apache.org>.
Khrol commented on a change in pull request #14289:
URL: https://github.com/apache/airflow/pull/14289#discussion_r578389512



##########
File path: tests/providers/slack/hooks/test_slack.py
##########
@@ -120,7 +120,7 @@ def test_call_with_failure(self, slack_client_class_mock):
         test_api_params = {'key1': 'value1', 'key2': 'value2'}
 
         with pytest.raises(SlackApiError):
-            slack_hook.call(test_method, test_api_params)

Review comment:
       Even more. I had to update test due to **linter** error on CI and not test execution result. The test execution should be green before and after my change.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] Khrol commented on a change in pull request #14289: Don't allow SlackHook accept *args

Posted by GitBox <gi...@apache.org>.
Khrol commented on a change in pull request #14289:
URL: https://github.com/apache/airflow/pull/14289#discussion_r578388596



##########
File path: tests/providers/slack/hooks/test_slack.py
##########
@@ -120,7 +120,7 @@ def test_call_with_failure(self, slack_client_class_mock):
         test_api_params = {'key1': 'value1', 'key2': 'value2'}
 
         with pytest.raises(SlackApiError):
-            slack_hook.call(test_method, test_api_params)

Review comment:
       `slack_client_mock.api_call = mock.Mock(side_effect=expected_exception)`
   
   `api_call` method was mocked and mock didn't 100% mimic original signature with only one positional argument. So the test was green before my change.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org