bots: Add mypy annotations for bots framework.

This commit adds mypy annotations for both the main
bots and the bots testing runner. It involves a change
to the BotHandlerApi send_message and update_message
funtions, which is compatible with every bot.

Tweaked by tabbott to use more expressive annotations.
This commit is contained in:
derAnfaenger 2017-05-26 06:58:19 +02:00 committed by Tim Abbott
parent bd4be69148
commit 8f2f2d220e
4 changed files with 53 additions and 12 deletions

View file

@ -20,9 +20,12 @@ if __name__ == '__main__':
sys.path.insert(0, root_dir)
loader = unittest.TestLoader()
# mypy doesn't recognize the TestLoader attribute, even though the code
# is executable
loader = unittest.TestLoader() # type: ignore
suite = loader.discover(start_dir=bots_test_dir, top_level_dir=root_dir)
runner = unittest.TextTestRunner(verbosity=2)
result = runner.run(suite)
# same issue as for TestLoader
result = runner.run(suite) # type: ignore
if result.errors or result.failures:
raise Exception('Test failed!')