def create_bot():
""" Fixture - create the bot object given the bot_class and then add the
endpoint object using the http_class.
Using the fixture because at the end of the test the webserver is
closed no matter the test outcome
"""
fixture = dict()
def create(bot, endpoint):
""" The real function that creates the bot.
This is needed because the fixture cannot accept parameters.
"""
fixture['bot'] = bot
fixture['ep'] = endpoint
fixture['bot'].add_endpoint(fixture['ep'])
fixture['bot'].run()
return fixture['bot']
yield create
fixture['bot'].stop()
评论列表
文章目录