You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: