-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpytest_flags.py
More file actions
89 lines (86 loc) · 2.65 KB
/
pytest_flags.py
File metadata and controls
89 lines (86 loc) · 2.65 KB
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
"""pytest flag configuration for API coverage."""
import pytest
def add_pytest_api_cov_flags(parser: pytest.Parser) -> None:
"""Add API coverage flags to the parser."""
parser.addoption(
"--api-cov-report",
action="store_true",
default=False,
help="Generate API coverage report.",
)
parser.addoption(
"--api-cov-fail-under",
action="store",
type=float,
default=None,
help="Fail if API coverage is below this percentage.",
)
parser.addoption(
"--api-cov-show-uncovered-endpoints",
action="store_true",
default=False,
help="Show uncovered endpoints in the console report (default: True).",
)
parser.addoption(
"--api-cov-hide-uncovered-endpoints",
action="store_true",
default=False,
help="Hide uncovered endpoints in the console report.",
)
parser.addoption(
"--api-cov-show-covered-endpoints",
action="store_true",
default=False,
help="Show covered endpoints in the console report.",
)
parser.addoption(
"--api-cov-show-excluded-endpoints",
action="store_true",
default=False,
help="Show excluded endpoints in the console report.",
)
parser.addoption(
"--api-cov-exclusion-patterns",
action="append",
default=[],
help="Patterns for endpoints to exclude from coverage.",
)
parser.addoption(
"--api-cov-report-path",
action="store",
type=str,
default=None,
help="Path to save the API coverage report.",
)
parser.addoption(
"--api-cov-force-sugar",
action="store_true",
default=False,
help="Force use of API coverage sugar in console report.",
)
parser.addoption(
"--api-cov-force-sugar-disabled",
action="store_true",
default=False,
help="Disable use of API coverage sugar in console report.",
)
parser.addoption(
"--api-cov-client-fixture-names",
action="append",
type=str,
default=None,
help="Name of existing test client fixture(s) to wrap. Use multiple times for multiple fixtures.",
)
parser.addoption(
"--api-cov-group-methods-by-endpoint",
action="store_true",
default=False,
help="Group HTTP methods by endpoint for legacy behavior (default: method-aware coverage)",
)
parser.addoption(
"--api-cov-openapi-spec",
action="store",
type=str,
default=None,
help="Path to OpenAPI spec file (JSON or YAML) to use as source of truth for endpoints.",
)