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

[Problem] Unit tests for interface code to Telethon #16

Open
pekasen opened this issue Jul 22, 2022 · 0 comments
Open

[Problem] Unit tests for interface code to Telethon #16

pekasen opened this issue Jul 22, 2022 · 0 comments
Assignees
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@pekasen
Copy link
Member

pekasen commented Jul 22, 2022

Problem: Telethon requires the client to be registered and authenticated with Telegram with makes running tests quite difficult.
As Telethon is an implementation of Telegram's MTProto-protocol which utilizes TCP with the low-level socket-package, mocking is not easily done with readily-available packages.

Solution 1: Mocking the Telethon.TelegramClient with prerecorded/mock data. Would require a sophisticated implementation and introduces quite some complexity.
Additionally it will require some learning about asyncio's EventLoops and how to disable actual requests to socket.socket.

Solution 2: Marking the tests that require interactions with Telethon/Telegram optional and running them if valid crendentials are supplied by the user and pytest is told by the user to do so – this would mean that running tests in GH actions on push/pull request may be quite expensive as rate limit errors may cause the test to pause for ~24h.

Further alternatives and input is more than welcome.

@pekasen pekasen added help wanted Extra attention is needed question Further information is requested labels Jul 22, 2022
@pekasen pekasen self-assigned this Jul 22, 2022
@pekasen pekasen transferred this issue from Leibniz-HBI/smormlpy Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant