conftest.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:eddie 作者: greenkey 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号