標記和配合器

有些內建標記和配合器在 pytest-cov 中。

標記

no_cover

例如

@pytest.mark.no_cover
def test_foobar():
    # do some stuff that needs coverage disabled

警告

警示

請注意,子程序的覆蓋率也會被停用。

配合器

no_cover

例如

def test_foobar(no_cover):
    # same as the marker ...

cov

出於某些沒人記得的原因,有一個 cov 搭配器提供存取底層 Coverage 實例的權限。有人說這是一個偽裝的自我毀滅按鈕,應該移除,也有人認為謎團讓生活更有趣,它應該保留。