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?
This commit is contained in:
parent
9ed0fa9e6f
commit
d929cdb91e
|
@ -4,6 +4,7 @@ import unittest
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from zulip_botserver import server
|
from zulip_botserver import server
|
||||||
from .server_test_lib import BotServerTestCase
|
from .server_test_lib import BotServerTestCase
|
||||||
|
import six
|
||||||
|
|
||||||
class BotServerTests(BotServerTestCase):
|
class BotServerTests(BotServerTestCase):
|
||||||
class MockMessageHandler(object):
|
class MockMessageHandler(object):
|
||||||
|
@ -48,13 +49,14 @@ class BotServerTests(BotServerTestCase):
|
||||||
'site': 'http://localhost',
|
'site': 'http://localhost',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# This complains about mismatching argument types, yet they are all correct?
|
# TODO: The following passes mypy, though the six stubs don't match the
|
||||||
# We should investigate and file an issue in mypy.
|
# unittest ones, so we could file a mypy bug to improve this.
|
||||||
self.assertRaisesRegexp(ImportError, # type: ignore
|
six.assertRaisesRegex(self,
|
||||||
"Bot \"nonexistent-bot\" doesn't exists. Please "
|
ImportError,
|
||||||
"make sure you have set up the flaskbotrc file correctly.",
|
"Bot \"nonexistent-bot\" doesn't exists. Please "
|
||||||
lambda: self.assert_bot_server_response(available_bots=available_bots,
|
"make sure you have set up the flaskbotrc file correctly.",
|
||||||
bots_config=bots_config))
|
lambda: self.assert_bot_server_response(available_bots=available_bots,
|
||||||
|
bots_config=bots_config))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in a new issue