tasks.py 文件源码

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

项目:pytest-relaxed 作者: bitprophet 项目源码 文件源码
def coverage(c, html=True):
    """
    Run coverage with coverage.py.
    """
    # NOTE: this MUST use coverage itself, and not pytest-cov, because the
    # latter is apparently unable to prevent pytest plugins from being loaded
    # before pytest-cov itself is able to start up coverage.py! The result is
    # that coverage _always_ skips over all module level code, i.e. constants,
    # 'def' lines, etc. Running coverage as the "outer" layer avoids this
    # problem, thus no need for pytest-cov.
    # NOTE: this does NOT hold true for NON-PYTEST code, so
    # pytest-relaxed-USING modules can happily use pytest-cov.
    c.run("coverage run --source=pytest_relaxed -m pytest")
    if html:
        c.run("coverage html")
        c.run("open htmlcov/index.html")


# TODO: good candidate for builtin-to-invoke "just wrap <other task> with a
# tiny bit of behavior", and/or args/kwargs style invocations
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号