Bugfix for custom message tests, pep8 fix.

Custom message tests weren't actually testing the message passed as
parameter, but instead were modifying the global messages.