Skip to content

Conversation

@csaska
Copy link
Contributor

@csaska csaska commented Sep 16, 2020

Summary

Fixes #809

3ef65f3 changed files_upload behavior to always set default filename regardless of instace type of file input parameter. If file is of type IOBase, which the type hinting indicates is supported, #L1496 would raise an exception when trying to call split on a non-string type. Since the Slack API files_upload does not require a filename to upload, I do not believe this method should either.

No unit tests added as this code change should still be coverd by https://github.com/slackapi/python-slackclient/blob/033fb44f64d5c5f5664a8b6752adf3e4beba7854/integration_tests/web/test_issue_672.py#L65

I can add a test for file being an IOBase instance.

Category (place an x in each of the [ ])

  • [x ] slack.web.WebClient (Web API client)
  • slack.webhook.WebhookClient (Incoming Webhook, response_url sender)
  • slack.web.classes (UI component builders)
  • slack.rtm.RTMClient (RTM client)

Requirements (place an x in each [ ])

  • [x ] I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • [x ] I've read and agree to the Code of Conduct.
  • [x ] I've run python setup.py validate after making the changes.

@gitwave gitwave bot added the untriaged label Sep 16, 2020
@CLAassistant
Copy link

CLAassistant commented Sep 16, 2020

CLA assistant check
All committers have signed the CLA.

3ef65f3 changed files_upload behavior to always set default filename regardless of instace type of file input parameter. If file is of type IOBase, line 1496 would raise an exception. Since the Slack API files_upload does not require a filename to upload, I do not believe this method should either
@csaska
Copy link
Contributor Author

csaska commented Sep 16, 2020

None of the integrations tests appear to be run by python setup.py validate. Is their a process for running everything in integration_tests directory?

@codecov
Copy link

codecov bot commented Sep 16, 2020

Codecov Report

Merging #810 into main will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #810   +/-   ##
=======================================
  Coverage   87.29%   87.29%           
=======================================
  Files          30       30           
  Lines        3722     3722           
  Branches      328      328           
=======================================
  Hits         3249     3249           
  Misses        330      330           
  Partials      143      143           
Impacted Files Coverage Δ
slack/web/async_client.py 91.64% <0.00%> (ø)
slack/web/client.py 94.73% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 033fb44...7721499. Read the comment docs.

@seratch seratch added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:patch Version: 2x web-client and removed untriaged labels Sep 17, 2020
@seratch seratch added this to the 2.8.3 milestone Sep 17, 2020
@seratch
Copy link
Contributor

seratch commented Sep 17, 2020

@csaska Thanks for making this PR!

None of the integrations tests appear to be run by python setup.py validate. Is their a process for running everything in integration_tests directory?

You can use python setup.py run_integration_tests https://github.com/slackapi/python-slackclient/blob/v2.8.2/setup.py#L255

Running all the integration tests requires preps. You can run a single test case by python setup.py run_integration_tests --test-target integration_tests/web/test_issue_770.py.

We would like to have both a unit test and an integration test for this case but I can take the task. Your change looks good to me already and you don't need to use more of your time for this. Thanks a lot!

I will work on tests and will be releasing a new patch version soon.

@seratch seratch self-assigned this Sep 17, 2020
seratch added a commit that referenced this pull request Sep 17, 2020
@seratch seratch merged commit 7721499 into slackapi:main Sep 17, 2020
@seratch
Copy link
Contributor

seratch commented Sep 17, 2020

@csaska Thanks a lot for your contribution! I've added tests for this change and verified it works as we expect. 4dd2a32

@csaska
Copy link
Contributor Author

csaska commented Sep 17, 2020

@seratch thanks for the follow up about the unit tests and quick turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:patch Version: 2x web-client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setting default filename in web client files_upload causes AttributeError for file being IOBase instance

3 participants