conftest.py 文件源码

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

项目:micromasters 作者: mitodl 项目源码 文件源码
def internal_api_patcher():
    """
    Fixture that patches certain internal app functions for the entire selenium suite execution
    """
    methods_to_patch = [
        'mail.api.MailgunClient._mailgun_request',
    ]
    patcher_mocks = []
    patchers = [patch(method_name) for method_name in methods_to_patch]
    for patcher in patchers:
        mock = patcher.start()
        mock.name = patcher.attribute
        patcher_mocks.append(mock)
    yield SimpleNamespace(
        patchers=patchers,
        patcher_mocks=patcher_mocks
    )
    for patcher in patchers:
        patcher.stop()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号