Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve unit test speed #1109

Merged
merged 4 commits into from
Jul 11, 2024
Merged

Conversation

WilliamBergamin
Copy link
Contributor

@WilliamBergamin WilliamBergamin commented Jul 11, 2024

This PR is a follow up to #1017, it aim to speed up unit test execution

Many unit tests use asyncio.sleep before asserting that a request to mock_web_api_server was successfully processed. These changes allow unit tests to continue as soon as requests to mock_web_api_server are processed, instead of waiting an arbitrary amount of time.

This reuses the same logic introduced by #1017 and applies it to the async area of the unit tests.

Original

Screenshot 2024-07-11 at 12 53 04 PM

Before this PR

Screenshot 2024-07-11 at 12 53 36 PM

After

Screenshot 2024-07-11 at 12 53 57 PM

Take away

In GitHub actions using python 3.11, this PR allows the unit tests to run in 2m18s this is a 38% improvement compared to 3m45s previously and a 54% improvement compare to executions pre #1017

On my local machine using python 3.11, this PR allows the unit tests to run in 1m35s this is a 43% improvement compared to 2m49s previously

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

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Document pages under /docs
  • Others

Requirements (place an x in each [ ])

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_all_and_run_tests.sh after making the changes.

Copy link

codecov bot commented Jul 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.80%. Comparing base (7b19d3d) to head (c323fdc).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1109      +/-   ##
==========================================
+ Coverage   91.79%   91.80%   +0.01%     
==========================================
  Files         186      186              
  Lines        6408     6408              
==========================================
+ Hits         5882     5883       +1     
+ Misses        526      525       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Looks good to me

@seratch seratch merged commit e64be38 into slackapi:main Jul 11, 2024
12 checks passed
@WilliamBergamin WilliamBergamin deleted the speed-up-tests branch July 12, 2024 12:54
@WilliamBergamin WilliamBergamin modified the milestones: 1.19.2, 1.20.0 Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants