conftest.py 文件源码

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

项目:two1-python 作者: 21dotco 项目源码 文件源码
def patch_click(monkeypatch):
    """ Fixture that monkeypatches click printing functions

        Patches functions like click.echo to capture all output in
        a mock to use functions like mock.assert_called_once_with().

        In the test you can directly import and use click functions
        as a Mock. For example:

            import click
            click.assert_called_with()
    """
    echo_mock = mock.Mock()
    confirm_mock = mock.Mock()
    monkeypatch.setattr(click, "echo", echo_mock)
    monkeypatch.setattr(click, "confirm", confirm_mock)
    return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号