From d929cdb91e54f58ca2b408f06c76bd7e4088f65a Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Wed, 15 Nov 2017 09:44:52 -0800 Subject: [PATCH] botserver testing: Move to six.assertRaisesRegex from Regexp variant. This ensures 2/3 compatibility. The mypy test also now passes, though the six stubs appear very minimal - maybe incorrect? --- zulip_botserver/tests/test_server.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/zulip_botserver/tests/test_server.py b/zulip_botserver/tests/test_server.py index 1c5e01c..048303d 100644 --- a/zulip_botserver/tests/test_server.py +++ b/zulip_botserver/tests/test_server.py @@ -4,6 +4,7 @@ import unittest from typing import Any from zulip_botserver import server from .server_test_lib import BotServerTestCase +import six class BotServerTests(BotServerTestCase): class MockMessageHandler(object): @@ -48,13 +49,14 @@ class BotServerTests(BotServerTestCase): 'site': 'http://localhost', } } - # This complains about mismatching argument types, yet they are all correct? - # We should investigate and file an issue in mypy. - self.assertRaisesRegexp(ImportError, # type: ignore - "Bot \"nonexistent-bot\" doesn't exists. Please " - "make sure you have set up the flaskbotrc file correctly.", - lambda: self.assert_bot_server_response(available_bots=available_bots, - bots_config=bots_config)) + # TODO: The following passes mypy, though the six stubs don't match the + # unittest ones, so we could file a mypy bug to improve this. + six.assertRaisesRegex(self, + ImportError, + "Bot \"nonexistent-bot\" doesn't exists. Please " + "make sure you have set up the flaskbotrc file correctly.", + lambda: self.assert_bot_server_response(available_bots=available_bots, + bots_config=bots_config)) if __name__ == '__main__': unittest.main()