Reduce Creation of HTTP Clients in Tests by Bibo-Joshi · Pull Request #4493 · python-telegram-bot/python-telegram-bot · GitHub
Skip to content

Reduce Creation of HTTP Clients in Tests#4493

Merged
Bibo-Joshi merged 5 commits intomasterfrom
test-performance
Sep 25, 2024
Merged

Reduce Creation of HTTP Clients in Tests#4493
Bibo-Joshi merged 5 commits intomasterfrom
test-performance

Conversation

@Bibo-Joshi
Copy link
Copy Markdown
Member

Apparently the function load_ssl_context_verify that's called upon the creation of httpx.AsyncClient takes quite a bit of time so that creating new HTTPXRequest objects (indirectly via Bot) is a performance bottleneck in the tests.

Hence, this changing make_bot to use offline=True by default and allowing online only in the tests that make requests.

This is just one small step on test performance improvement, but hey it's something :)

@Bibo-Joshi Bibo-Joshi added the ⚙️ tests affected functionality: tests label Sep 21, 2024
@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 21, 2024

Copy link
Copy Markdown
Member

@harshil21 harshil21 left a comment

Choose a reason for hiding this comment

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

Do you know what % of time was the calling of load_ssl_context_verify taking?

@Bibo-Joshi Bibo-Joshi merged commit 79e589b into master Sep 25, 2024
@Bibo-Joshi Bibo-Joshi deleted the test-performance branch September 25, 2024 15:17
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

⚙️ tests affected functionality: tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants