summaryrefslogtreecommitdiff
path: root/metacov.ini
blob: 884babf7e10d933a062229555eeb119ae369fda3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt

# Settings to use when using coverage.py to measure itself, known as
# meta-coverage.  This gets intricate because we need to keep the coverage
# measurement happening in the tests separate from our own coverage measurement
# of coverage.py itself.

[run]
branch = true
data_file = ${COVERAGE_METAFILE-.metacov}
parallel = true
relative_files = true
source =
    ${COVERAGE_HOME-.}/coverage
    ${COVERAGE_HOME-.}/tests
# $set_env.py: COVERAGE_DYNCTX - Set to 'test_function' for who-tests-what
dynamic_context = ${COVERAGE_DYNCTX-none}
# $set_env.py: COVERAGE_CONTEXT - Static context for this run (or $ENV_VAR like $TOX_ENV_NAME)
context = ${COVERAGE_CONTEXT-none}

[report]
# We set different pragmas so our code won't be confused with test code, and
# we use different pragmas for different reasons that the lines won't be
# measured.
exclude_lines =
    pragma: not covered

    # Lines in test code that aren't covered: we are nested inside ourselves.
    # Sometimes this is used as a comment:
    #
    #       cov.start()
    #       blah()              # pragma: nested
    #       cov.stop()          # pragma: nested
    #
    # In order to exclude a series of lines, sometimes it's used as a constant
    # condition, which might be too cute:
    #
    #       cov.start()
    #       if "pragma: nested":
    #           blah()
    #           cov.stop()
    #
    pragma: nested

    # Lines that are only executed when we are debugging coverage.py.
    def __repr__
    pragma: debugging

    # Lines that are only executed when we are not testing coverage.py.
    pragma: not testing

    # Lines that we can't run during metacov.
    pragma: no metacov
    pytest.mark.skipif\(env.METACOV
    if not env.METACOV:

    # These lines only happen if tests fail.
    raise AssertionError
    pragma: only failure

    # Not-real code for type checking
    if TYPE_CHECKING:
    class .*\(Protocol\):

    # OS error conditions that we can't (or don't care to) replicate.
    pragma: cant happen

    # Obscure bugs in specific versions of interpreters, and so probably no
    # longer tested.
    pragma: obscure

partial_branches =
    pragma: part covered
    # A for-loop that always hits its break statement
    pragma: always breaks
    pragma: part started
    # If we're asserting that any() is true, it didn't finish.
    assert any\(
    if env.TESTING:
    if env.METACOV:

precision = 3

[html]
title = Coverage.py metacov

[paths]
source =
    .
    */coverage/trunk
    # GitHub Actions on Ubuntu uses /home/runner/work/coveragepy
    # GitHub Actions on Mac uses /Users/runner/work/coveragepy
    # GitHub Actions on Window uses D:\a\coveragepy\coveragepy
    *\coveragepy
    */coveragepy