Testing tools#

The best code comes with unit tests. Sopel provides a pytest plugin with standard fixtures; factories and mocks to support writing tests; and the rawlist() function to help analyze the mocked-up bot’s output.

sopel.tests#

Test tools, factories, pytest fixtures, and mocks.

New in version 7.0.

sopel.tests.rawlist(*args)#

Build a list of raw IRC messages from the lines given as *args.

Returns:

a list of raw IRC messages as seen by the bot

Return type:

list

This is a helper function to build a list of messages without having to care about encoding or this pesky carriage return:

>>> rawlist('PRIVMSG :Hello!')
[b'PRIVMSG :Hello!\r\n']