【发布时间】:2021-04-13 15:38:48
【问题描述】:
我正在使用 pytest 运行一组测试,并且还想使用 coverage 包测量其覆盖率。
我的代码中有一些装饰器,使用以下方式将测试分成几个套件:
@pytest.mark.firstgroup
def test_myfirsttest():
assert True is True
@pytest.mark.secondgroup
def test_mysecondtest():
assert False is False
我需要找到类似的东西:
coverage run --suite=firstgroup -m pytest
所以在这种情况下,只有第一个测试,因为它在正确的套件中,将用于测试覆盖率。
当我直接使用pytest 时,这些套件可以正常工作,但我不知道如何在coverage 中使用它们
有没有办法配置coverage 来实现这一点?
【问题讨论】:
标签: python pytest code-coverage coverage.py