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
Not really sure how to do it in the master branch, but it is quite easy in the python3 branch : see commit 50b3b73
The idea is that the bot_jabber module used to manage answers to messages by creating a thread for each message.
With commit a7e16c0 I moved the thread management from bot_jabber to the parent class bot, so the bot_jabber and the bot_test behave the same way.
In test mode, there is an output attribute to the bot, which is a python Queue. Each message is written in the Queue, even if it is done in a Thread. So even if you use an async module, all you have to do is create your module, and then in your test, just call the get() method of the Queue to retrieve messages.
Since get() is blocking, it will wait for your AsyncModule to do call bot.say to be unlocked, and you can verify the content of the message, the delay, etc.
Is there a way to write unit tests for AsyncModules ?
The text was updated successfully, but these errors were encountered: