better-coverage 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- better_coverage/__init__.py +0 -0
- better_coverage/plugin.py +729 -0
- better_coverage/py.typed +0 -0
- better_coverage-1.0.0.dist-info/METADATA +62 -0
- better_coverage-1.0.0.dist-info/RECORD +9 -0
- better_coverage-1.0.0.dist-info/WHEEL +5 -0
- better_coverage-1.0.0.dist-info/entry_points.txt +2 -0
- better_coverage-1.0.0.dist-info/licenses/LICENSE +201 -0
- better_coverage-1.0.0.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,729 @@
|
|
|
1
|
+
"""Jest-style coverage reporter for pytest.
|
|
2
|
+
|
|
3
|
+
A pixel-perfect port of Istanbul's text reporter to Python, providing
|
|
4
|
+
Jest-compatible coverage output for pytest-cov.
|
|
5
|
+
|
|
6
|
+
This module implements:
|
|
7
|
+
- Tree-based coverage reporting (directories and files)
|
|
8
|
+
- Visitor pattern for tree traversal
|
|
9
|
+
- Terminal width-aware column truncation
|
|
10
|
+
- Color-coded output matching Istanbul's watermarks
|
|
11
|
+
- Support for branch coverage detection
|
|
12
|
+
|
|
13
|
+
Usage:
|
|
14
|
+
Install the package:
|
|
15
|
+
|
|
16
|
+
pip install better-coverage
|
|
17
|
+
|
|
18
|
+
Then run pytest with coverage:
|
|
19
|
+
|
|
20
|
+
pytest --cov=mypackage --cov-report=xml
|
|
21
|
+
|
|
22
|
+
The Jest-style coverage table will print automatically after tests.
|
|
23
|
+
|
|
24
|
+
The plugin is auto-discovered by pytest via entry points, no configuration needed.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
import os
|
|
28
|
+
import shutil
|
|
29
|
+
from dataclasses import dataclass
|
|
30
|
+
from typing import Any, Callable, Dict, List, Optional, Tuple
|
|
31
|
+
|
|
32
|
+
import pytest
|
|
33
|
+
|
|
34
|
+
NAME_COL: int = 4
|
|
35
|
+
PCT_COLS: int = 7
|
|
36
|
+
MISSING_COL: int = 17
|
|
37
|
+
TAB_SIZE: int = 1
|
|
38
|
+
DELIM: str = " | "
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dataclass
|
|
42
|
+
class MetricData:
|
|
43
|
+
"""Coverage metric data structure.
|
|
44
|
+
|
|
45
|
+
Matches Istanbul's metric format: {total, covered, skipped, pct}
|
|
46
|
+
|
|
47
|
+
Attributes:
|
|
48
|
+
total: Total number of coverage points
|
|
49
|
+
covered: Number of covered points
|
|
50
|
+
skipped: Number of skipped points
|
|
51
|
+
pct: Coverage percentage (0-100)
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
total: int
|
|
55
|
+
covered: int
|
|
56
|
+
skipped: int
|
|
57
|
+
pct: float
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass
|
|
61
|
+
class CoverageSummary:
|
|
62
|
+
"""Aggregated coverage summary.
|
|
63
|
+
|
|
64
|
+
Matches Istanbul's CoverageSummary structure.
|
|
65
|
+
|
|
66
|
+
Attributes:
|
|
67
|
+
statements: Statement coverage metrics
|
|
68
|
+
branches: Branch coverage metrics
|
|
69
|
+
lines: Line coverage metrics
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
statements: MetricData
|
|
73
|
+
branches: MetricData
|
|
74
|
+
lines: MetricData
|
|
75
|
+
|
|
76
|
+
def is_empty(self) -> bool:
|
|
77
|
+
"""Check if coverage data is empty."""
|
|
78
|
+
return self.statements.total == 0
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class CoverageNode:
|
|
82
|
+
"""Tree node representing a file or directory in the coverage hierarchy.
|
|
83
|
+
|
|
84
|
+
Implements Istanbul's node protocol for visitor pattern traversal.
|
|
85
|
+
|
|
86
|
+
Attributes:
|
|
87
|
+
name: Node name (filename or directory name)
|
|
88
|
+
parent: Parent node reference
|
|
89
|
+
children: Dictionary of child nodes
|
|
90
|
+
file_data: Coverage.py analysis data for files
|
|
91
|
+
is_file: True if this is a file node, False for directories
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
def __init__(self, name: str, parent: Optional["CoverageNode"] = None) -> None:
|
|
95
|
+
"""Initialize coverage node.
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
name: Node name
|
|
99
|
+
parent: Parent node (None for root)
|
|
100
|
+
"""
|
|
101
|
+
self.name: str = name
|
|
102
|
+
self.parent: Optional["CoverageNode"] = parent
|
|
103
|
+
self.children: Dict[str, "CoverageNode"] = {}
|
|
104
|
+
self.file_data: Optional[Tuple[str, List[int], List[int], List[int], str]] = None
|
|
105
|
+
self.is_file: bool = False
|
|
106
|
+
|
|
107
|
+
def get_relative_name(self) -> str:
|
|
108
|
+
"""Get a node's relative name.
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
Node name, or 'All files' for root
|
|
112
|
+
"""
|
|
113
|
+
return self.name if self.name else "All files"
|
|
114
|
+
|
|
115
|
+
def is_summary(self) -> bool:
|
|
116
|
+
"""Check if this is a summary (directory) node.
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
True for directories, False for files
|
|
120
|
+
"""
|
|
121
|
+
return not self.is_file
|
|
122
|
+
|
|
123
|
+
def get_parent(self) -> Optional["CoverageNode"]:
|
|
124
|
+
"""Get parent node.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
Parent node or None for root
|
|
128
|
+
"""
|
|
129
|
+
return self.parent
|
|
130
|
+
|
|
131
|
+
def get_coverage_summary(self) -> CoverageSummary:
|
|
132
|
+
"""Calculate a coverage summary for this node.
|
|
133
|
+
|
|
134
|
+
For files, extracts metrics from coverage data.
|
|
135
|
+
For directories, aggregates metrics from all children.
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
Coverage summary with statement, branch, and line metrics
|
|
139
|
+
"""
|
|
140
|
+
if self.is_file and self.file_data:
|
|
141
|
+
fname, executed, excluded, missing, _ = self.file_data
|
|
142
|
+
total: int = len(executed) + len(missing)
|
|
143
|
+
covered: int = len(executed)
|
|
144
|
+
pct: float = (covered / total * 100) if total > 0 else 100.0
|
|
145
|
+
|
|
146
|
+
return CoverageSummary(
|
|
147
|
+
statements=MetricData(total=total, covered=covered, skipped=0, pct=pct),
|
|
148
|
+
branches=MetricData(total=0, covered=0, skipped=0, pct=0),
|
|
149
|
+
lines=MetricData(total=total, covered=covered, skipped=0, pct=pct),
|
|
150
|
+
)
|
|
151
|
+
else:
|
|
152
|
+
total_stmts: int = 0
|
|
153
|
+
covered_stmts: int = 0
|
|
154
|
+
total_lines: int = 0
|
|
155
|
+
covered_lines: int = 0
|
|
156
|
+
|
|
157
|
+
for child in self.children.values():
|
|
158
|
+
summary: CoverageSummary = child.get_coverage_summary()
|
|
159
|
+
total_stmts += summary.statements.total
|
|
160
|
+
covered_stmts += summary.statements.covered
|
|
161
|
+
total_lines += summary.lines.total
|
|
162
|
+
covered_lines += summary.lines.covered
|
|
163
|
+
|
|
164
|
+
stmt_pct: float = (covered_stmts / total_stmts * 100) if total_stmts > 0 else 0
|
|
165
|
+
line_pct: float = (covered_lines / total_lines * 100) if total_lines > 0 else 0
|
|
166
|
+
|
|
167
|
+
return CoverageSummary(
|
|
168
|
+
statements=MetricData(total=total_stmts, covered=covered_stmts, skipped=0, pct=stmt_pct),
|
|
169
|
+
branches=MetricData(total=0, covered=0, skipped=0, pct=0),
|
|
170
|
+
lines=MetricData(total=total_lines, covered=covered_lines, skipped=0, pct=line_pct),
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
def get_file_coverage(self) -> Optional[Tuple[str, List[int], List[int], List[int], str]]:
|
|
174
|
+
"""Get raw file coverage data.
|
|
175
|
+
|
|
176
|
+
Returns:
|
|
177
|
+
Coverage.py analysis tuple for files, None for directories
|
|
178
|
+
"""
|
|
179
|
+
return self.file_data
|
|
180
|
+
|
|
181
|
+
def visit(self, visitor: Any) -> None:
|
|
182
|
+
"""Visit this node and all children using a visitor pattern.
|
|
183
|
+
|
|
184
|
+
Calls visitor.on_summary() for directories and visitor.on_detail() for files.
|
|
185
|
+
|
|
186
|
+
Args:
|
|
187
|
+
visitor: Visitor object with on_summary() and on_detail() methods
|
|
188
|
+
"""
|
|
189
|
+
if self.is_file:
|
|
190
|
+
visitor.on_detail(self)
|
|
191
|
+
else:
|
|
192
|
+
visitor.on_summary(self)
|
|
193
|
+
for child in sorted(self.children.values(), key=lambda n: n.name):
|
|
194
|
+
child.visit(visitor)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def padding(num: int, ch: str = " ") -> str:
|
|
198
|
+
"""Generate padding string.
|
|
199
|
+
|
|
200
|
+
Args:
|
|
201
|
+
num: Number of characters
|
|
202
|
+
ch: Character to use for padding
|
|
203
|
+
|
|
204
|
+
Returns:
|
|
205
|
+
String of repeated characters
|
|
206
|
+
"""
|
|
207
|
+
return ch * num
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def fill(text: Any, width: int, right: bool = False, tabs: int = 0) -> str:
|
|
211
|
+
"""Fill text to a specified width with padding.
|
|
212
|
+
|
|
213
|
+
Matches Istanbul's fill() function exactly, including truncation logic.
|
|
214
|
+
|
|
215
|
+
Args:
|
|
216
|
+
text: Text to fill
|
|
217
|
+
width: Target width
|
|
218
|
+
right: If True, right-align text
|
|
219
|
+
tabs: Number of tabs (TAB_SIZE spaces each) to indent
|
|
220
|
+
|
|
221
|
+
Returns:
|
|
222
|
+
Padded/truncated string
|
|
223
|
+
"""
|
|
224
|
+
text = str(text)
|
|
225
|
+
leading_spaces: int = tabs * TAB_SIZE
|
|
226
|
+
remaining: int = width - leading_spaces
|
|
227
|
+
leader: str = padding(leading_spaces)
|
|
228
|
+
fmt_str: str = ""
|
|
229
|
+
|
|
230
|
+
if remaining > 0:
|
|
231
|
+
strlen: int = len(text)
|
|
232
|
+
|
|
233
|
+
if remaining >= strlen:
|
|
234
|
+
fill_str: str = padding(remaining - strlen)
|
|
235
|
+
else:
|
|
236
|
+
fill_str = "..."
|
|
237
|
+
length: int = remaining - len(fill_str)
|
|
238
|
+
text = text[strlen - length :]
|
|
239
|
+
right = True
|
|
240
|
+
|
|
241
|
+
fmt_str = fill_str + text if right else text + fill_str
|
|
242
|
+
|
|
243
|
+
return leader + fmt_str
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def format_name(name: str, max_cols: int, level: int) -> str:
|
|
247
|
+
"""Format filename with indentation.
|
|
248
|
+
|
|
249
|
+
Args:
|
|
250
|
+
name: Filename
|
|
251
|
+
max_cols: Maximum column width
|
|
252
|
+
level: Indentation level (0 for root)
|
|
253
|
+
|
|
254
|
+
Returns:
|
|
255
|
+
Formatted, indented name
|
|
256
|
+
"""
|
|
257
|
+
return fill(name, max_cols, False, level)
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def format_pct(pct: Any, width: int = PCT_COLS) -> str:
|
|
261
|
+
"""Format percentage value, right-aligned.
|
|
262
|
+
|
|
263
|
+
Args:
|
|
264
|
+
pct: Percentage value (number or string)
|
|
265
|
+
width: Column width
|
|
266
|
+
|
|
267
|
+
Returns:
|
|
268
|
+
Formatted percentage string
|
|
269
|
+
"""
|
|
270
|
+
return fill(pct, width, True, 0)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
def node_missing(node: CoverageNode) -> str: # noqa: C901
|
|
274
|
+
"""Calculate uncovered line ranges for a file.
|
|
275
|
+
|
|
276
|
+
Matches Istanbul's nodeMissing() algorithm exactly.
|
|
277
|
+
Returns empty string for directories.
|
|
278
|
+
|
|
279
|
+
Args:
|
|
280
|
+
node: Coverage node
|
|
281
|
+
|
|
282
|
+
Returns:
|
|
283
|
+
Comma-separated line ranges (e.g. "12-15,20,25-30")
|
|
284
|
+
"""
|
|
285
|
+
if node.is_summary():
|
|
286
|
+
return ""
|
|
287
|
+
|
|
288
|
+
metrics: CoverageSummary = node.get_coverage_summary()
|
|
289
|
+
if metrics.is_empty():
|
|
290
|
+
return ""
|
|
291
|
+
|
|
292
|
+
lines_pct: float = metrics.lines.pct
|
|
293
|
+
file_data: Optional[Tuple[str, List[int], List[int], List[int], str]] = node.get_file_coverage()
|
|
294
|
+
|
|
295
|
+
if not file_data:
|
|
296
|
+
return ""
|
|
297
|
+
|
|
298
|
+
fname, executed, excluded, missing, _ = file_data
|
|
299
|
+
|
|
300
|
+
if lines_pct == 100:
|
|
301
|
+
return ""
|
|
302
|
+
|
|
303
|
+
if not missing:
|
|
304
|
+
return ""
|
|
305
|
+
|
|
306
|
+
missing_sorted = sorted(missing)
|
|
307
|
+
|
|
308
|
+
new_range: bool = True
|
|
309
|
+
acum: List[List[int]] = []
|
|
310
|
+
|
|
311
|
+
for line_num in missing_sorted:
|
|
312
|
+
line_num = int(line_num)
|
|
313
|
+
if new_range:
|
|
314
|
+
acum.append([line_num])
|
|
315
|
+
new_range = False
|
|
316
|
+
else:
|
|
317
|
+
if line_num == acum[-1][-1] + 1:
|
|
318
|
+
if len(acum[-1]) == 1:
|
|
319
|
+
acum[-1].append(line_num)
|
|
320
|
+
else:
|
|
321
|
+
acum[-1][1] = line_num
|
|
322
|
+
else:
|
|
323
|
+
acum.append([line_num])
|
|
324
|
+
|
|
325
|
+
ranges: List[Any] = []
|
|
326
|
+
for range_item in acum:
|
|
327
|
+
if len(range_item) == 1:
|
|
328
|
+
ranges.append(range_item[0])
|
|
329
|
+
else:
|
|
330
|
+
ranges.append(f"{range_item[0]}-{range_item[1]}")
|
|
331
|
+
|
|
332
|
+
return ",".join(str(r) for r in ranges)
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
def node_name(node: CoverageNode) -> str:
|
|
336
|
+
"""Get display name for node.
|
|
337
|
+
|
|
338
|
+
Args:
|
|
339
|
+
node: Coverage node
|
|
340
|
+
|
|
341
|
+
Returns:
|
|
342
|
+
Node name or 'All files' for root
|
|
343
|
+
"""
|
|
344
|
+
return node.get_relative_name() or "All files"
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
def depth_for(node: CoverageNode) -> int:
|
|
348
|
+
"""Calculate node depth by counting parents.
|
|
349
|
+
|
|
350
|
+
Args:
|
|
351
|
+
node: Coverage node
|
|
352
|
+
|
|
353
|
+
Returns:
|
|
354
|
+
Depth level (0 for root)
|
|
355
|
+
"""
|
|
356
|
+
ret: int = 0
|
|
357
|
+
current: Optional[CoverageNode] = node.get_parent()
|
|
358
|
+
while current:
|
|
359
|
+
ret += 1
|
|
360
|
+
current = current.get_parent()
|
|
361
|
+
return ret
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
def null_depth_for(_: CoverageNode) -> int:
|
|
365
|
+
"""Return zero depth (used for missing line calculations).
|
|
366
|
+
|
|
367
|
+
Args:
|
|
368
|
+
_: Coverage node
|
|
369
|
+
|
|
370
|
+
Returns:
|
|
371
|
+
Always 0
|
|
372
|
+
"""
|
|
373
|
+
return 0
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
def find_width(
|
|
377
|
+
root: CoverageNode, node_extractor: Callable[[CoverageNode], str], depth_fn: Callable[[CoverageNode], int] = null_depth_for
|
|
378
|
+
) -> int:
|
|
379
|
+
"""Find the maximum width needed for a column by walking the tree.
|
|
380
|
+
|
|
381
|
+
Args:
|
|
382
|
+
root: Root node to start traversal
|
|
383
|
+
node_extractor: Function to extract text from node
|
|
384
|
+
depth_fn: Function to calculate indentation depth
|
|
385
|
+
|
|
386
|
+
Returns:
|
|
387
|
+
Maximum width needed
|
|
388
|
+
"""
|
|
389
|
+
last: List[int] = [0]
|
|
390
|
+
|
|
391
|
+
def compare_width(node: CoverageNode) -> None:
|
|
392
|
+
last[0] = max(last[0], TAB_SIZE * depth_fn(node) + len(node_extractor(node)))
|
|
393
|
+
|
|
394
|
+
class WidthVisitor:
|
|
395
|
+
@staticmethod
|
|
396
|
+
def on_summary(n: CoverageNode) -> None:
|
|
397
|
+
compare_width(n)
|
|
398
|
+
|
|
399
|
+
@staticmethod
|
|
400
|
+
def on_detail(n: CoverageNode) -> None:
|
|
401
|
+
compare_width(n)
|
|
402
|
+
|
|
403
|
+
root.visit(WidthVisitor())
|
|
404
|
+
return last[0]
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
def make_line(name_width: int, missing_width: int) -> str:
|
|
408
|
+
"""Create a horizontal separator line.
|
|
409
|
+
|
|
410
|
+
Args:
|
|
411
|
+
name_width: Width of name column
|
|
412
|
+
missing_width: Width of uncovered lines column
|
|
413
|
+
|
|
414
|
+
Returns:
|
|
415
|
+
Separator line string
|
|
416
|
+
"""
|
|
417
|
+
name: str = padding(name_width, "-")
|
|
418
|
+
pct: str = padding(PCT_COLS, "-")
|
|
419
|
+
elements: List[str] = [name, pct, padding(PCT_COLS + 1, "-"), pct, padding(missing_width, "-")]
|
|
420
|
+
return DELIM.replace(" ", "-").join(elements) + "-"
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
def table_header(max_name_cols: int, missing_width: int) -> str:
|
|
424
|
+
"""Create a table header row.
|
|
425
|
+
|
|
426
|
+
Args:
|
|
427
|
+
max_name_cols: Width of name column
|
|
428
|
+
missing_width: Width of uncovered lines column
|
|
429
|
+
|
|
430
|
+
Returns:
|
|
431
|
+
Header row string
|
|
432
|
+
"""
|
|
433
|
+
elements: List[str] = [
|
|
434
|
+
format_name("File", max_name_cols, 0),
|
|
435
|
+
format_pct("% Stmts"),
|
|
436
|
+
format_pct("% Branch", PCT_COLS + 1),
|
|
437
|
+
format_pct("% Lines"),
|
|
438
|
+
format_name("Uncovered Line #s", missing_width, 0),
|
|
439
|
+
]
|
|
440
|
+
return DELIM.join(elements) + " "
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
def is_full(metrics: CoverageSummary) -> bool:
|
|
444
|
+
"""Check if coverage is 100%.
|
|
445
|
+
|
|
446
|
+
Args:
|
|
447
|
+
metrics: Coverage summary
|
|
448
|
+
|
|
449
|
+
Returns:
|
|
450
|
+
True if all metrics are 100%
|
|
451
|
+
"""
|
|
452
|
+
return metrics.statements.pct == 100 and metrics.branches.pct == 100 and metrics.lines.pct == 100
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
def class_for_percent(value: float) -> str:
|
|
456
|
+
"""Determine color class for percentage value.
|
|
457
|
+
|
|
458
|
+
Uses Istanbul's default watermarks: [50, 80]
|
|
459
|
+
|
|
460
|
+
Args:
|
|
461
|
+
value: Percentage value
|
|
462
|
+
|
|
463
|
+
Returns:
|
|
464
|
+
'high' (>= 80%), 'medium' (>= 50%), or 'low' (< 50%)
|
|
465
|
+
"""
|
|
466
|
+
if value >= 80:
|
|
467
|
+
return "high"
|
|
468
|
+
elif value >= 50:
|
|
469
|
+
return "medium"
|
|
470
|
+
else:
|
|
471
|
+
return "low"
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
def colorize(text: str, clazz: str) -> str:
|
|
475
|
+
"""Apply ANSI color codes to text.
|
|
476
|
+
|
|
477
|
+
Args:
|
|
478
|
+
text: Text to colorize
|
|
479
|
+
clazz: Color class ('high', 'medium', 'low')
|
|
480
|
+
|
|
481
|
+
Returns:
|
|
482
|
+
Colorized text with ANSI codes
|
|
483
|
+
"""
|
|
484
|
+
colors: Dict[str, str] = {
|
|
485
|
+
"low": "\033[31m",
|
|
486
|
+
"medium": "\033[33m",
|
|
487
|
+
"high": "\033[32m",
|
|
488
|
+
}
|
|
489
|
+
reset: str = "\033[0m"
|
|
490
|
+
|
|
491
|
+
if clazz in colors:
|
|
492
|
+
return f"{colors[clazz]}{text}{reset}"
|
|
493
|
+
return text
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
def table_row(
|
|
497
|
+
node: CoverageNode,
|
|
498
|
+
max_name_cols: int,
|
|
499
|
+
level: int,
|
|
500
|
+
skip_empty: bool,
|
|
501
|
+
skip_full: bool,
|
|
502
|
+
missing_width: int,
|
|
503
|
+
has_branch_coverage: bool,
|
|
504
|
+
) -> str:
|
|
505
|
+
"""Create a table row for a node.
|
|
506
|
+
|
|
507
|
+
Args:
|
|
508
|
+
node: Coverage node
|
|
509
|
+
max_name_cols: Width of name column
|
|
510
|
+
level: Indentation level
|
|
511
|
+
skip_empty: If True, skip empty files
|
|
512
|
+
skip_full: If True, skip 100% covered files
|
|
513
|
+
missing_width: Width of uncovered lines column
|
|
514
|
+
has_branch_coverage: If True, show branch coverage; otherwise show '?'
|
|
515
|
+
|
|
516
|
+
Returns:
|
|
517
|
+
Formatted table row or empty string if skipped
|
|
518
|
+
"""
|
|
519
|
+
name: str = node_name(node)
|
|
520
|
+
metrics: CoverageSummary = node.get_coverage_summary()
|
|
521
|
+
is_empty: bool = metrics.is_empty()
|
|
522
|
+
|
|
523
|
+
if skip_empty and is_empty:
|
|
524
|
+
return ""
|
|
525
|
+
if skip_full and is_full(metrics):
|
|
526
|
+
return ""
|
|
527
|
+
|
|
528
|
+
mm: Dict[str, float] = {
|
|
529
|
+
"statements": 0 if is_empty else metrics.statements.pct,
|
|
530
|
+
"branches": 0 if is_empty else metrics.branches.pct,
|
|
531
|
+
"lines": 0 if is_empty else metrics.lines.pct,
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
def colorize_cell(text: str, key: str) -> str:
|
|
535
|
+
if is_empty:
|
|
536
|
+
return text
|
|
537
|
+
return colorize(text, class_for_percent(mm[key]))
|
|
538
|
+
|
|
539
|
+
elements: List[str] = [
|
|
540
|
+
colorize_cell(format_name(name, max_name_cols, level), "statements"),
|
|
541
|
+
colorize_cell(format_pct(f"{mm['statements']:.2f}"), "statements"),
|
|
542
|
+
colorize_cell(format_pct("?" if not has_branch_coverage else f"{mm['branches']:.2f}", PCT_COLS + 1), "branches"),
|
|
543
|
+
colorize_cell(format_pct(f"{mm['lines']:.2f}"), "lines"),
|
|
544
|
+
colorize(format_name(node_missing(node), missing_width, 0), "medium" if mm["lines"] == 100 else "low"),
|
|
545
|
+
]
|
|
546
|
+
|
|
547
|
+
return DELIM.join(elements) + " "
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
class TextReport:
|
|
551
|
+
"""Istanbul-style text coverage report generator.
|
|
552
|
+
|
|
553
|
+
Matches Istanbul's TextReport class behavior exactly.
|
|
554
|
+
|
|
555
|
+
Attributes:
|
|
556
|
+
max_cols: Maximum terminal width (0 = unlimited)
|
|
557
|
+
skip_empty: Skip files with no coverage
|
|
558
|
+
skip_full: Skip files with 100% coverage
|
|
559
|
+
name_width: Calculated width for name column
|
|
560
|
+
missing_width: Calculated width for uncovered lines column
|
|
561
|
+
lines: Accumulated output lines
|
|
562
|
+
has_branch_coverage: Whether branch coverage is available
|
|
563
|
+
"""
|
|
564
|
+
|
|
565
|
+
def __init__(self, max_cols: Optional[int] = None, skip_empty: bool = False, skip_full: bool = False) -> None:
|
|
566
|
+
"""Initialize the text report.
|
|
567
|
+
|
|
568
|
+
Args:
|
|
569
|
+
max_cols: Maximum terminal width (None = auto-detect)
|
|
570
|
+
skip_empty: Skip empty files
|
|
571
|
+
skip_full: Skip 100% covered files
|
|
572
|
+
"""
|
|
573
|
+
self.max_cols: int = max_cols if max_cols is not None else 120
|
|
574
|
+
self.skip_empty: bool = skip_empty
|
|
575
|
+
self.skip_full: bool = skip_full
|
|
576
|
+
self.name_width: int = NAME_COL
|
|
577
|
+
self.missing_width: int = MISSING_COL
|
|
578
|
+
self.lines: List[str] = []
|
|
579
|
+
self.has_branch_coverage: bool = False
|
|
580
|
+
|
|
581
|
+
def on_start(self, root: CoverageNode) -> None:
|
|
582
|
+
"""Initialize report and print header.
|
|
583
|
+
|
|
584
|
+
Calculates column widths and applies terminal width truncation.
|
|
585
|
+
|
|
586
|
+
Args:
|
|
587
|
+
root: Root coverage node
|
|
588
|
+
"""
|
|
589
|
+
self.name_width = max(NAME_COL, find_width(root, node_name, depth_for))
|
|
590
|
+
self.missing_width = max(MISSING_COL, find_width(root, node_missing))
|
|
591
|
+
|
|
592
|
+
if self.max_cols > 0:
|
|
593
|
+
pct_cols: int = len(DELIM) + 3 * (PCT_COLS + len(DELIM)) + 2
|
|
594
|
+
|
|
595
|
+
max_remaining: int = self.max_cols - (pct_cols + MISSING_COL)
|
|
596
|
+
if self.name_width > max_remaining:
|
|
597
|
+
self.name_width = max_remaining
|
|
598
|
+
self.missing_width = MISSING_COL
|
|
599
|
+
elif self.name_width < max_remaining:
|
|
600
|
+
max_remaining = self.max_cols - (self.name_width + pct_cols)
|
|
601
|
+
if self.missing_width > max_remaining:
|
|
602
|
+
self.missing_width = max_remaining
|
|
603
|
+
|
|
604
|
+
line: str = make_line(self.name_width, self.missing_width)
|
|
605
|
+
self.lines.append(line)
|
|
606
|
+
self.lines.append(table_header(self.name_width, self.missing_width))
|
|
607
|
+
self.lines.append(line)
|
|
608
|
+
|
|
609
|
+
def on_summary(self, node: CoverageNode) -> None:
|
|
610
|
+
"""Process directory node.
|
|
611
|
+
|
|
612
|
+
Args:
|
|
613
|
+
node: Directory node
|
|
614
|
+
"""
|
|
615
|
+
node_depth: int = depth_for(node)
|
|
616
|
+
row: str = table_row(
|
|
617
|
+
node, self.name_width, node_depth, self.skip_empty, self.skip_full, self.missing_width, self.has_branch_coverage
|
|
618
|
+
)
|
|
619
|
+
if row:
|
|
620
|
+
self.lines.append(row)
|
|
621
|
+
|
|
622
|
+
def on_detail(self, node: CoverageNode) -> None:
|
|
623
|
+
"""Process file node.
|
|
624
|
+
|
|
625
|
+
Args:
|
|
626
|
+
node: File node
|
|
627
|
+
"""
|
|
628
|
+
self.on_summary(node)
|
|
629
|
+
|
|
630
|
+
def on_end(self) -> None:
|
|
631
|
+
"""Print footer line."""
|
|
632
|
+
self.lines.append(make_line(self.name_width, self.missing_width))
|
|
633
|
+
|
|
634
|
+
def execute(self, root: CoverageNode) -> str:
|
|
635
|
+
"""Generate the complete coverage report.
|
|
636
|
+
|
|
637
|
+
Args:
|
|
638
|
+
root: Root coverage node
|
|
639
|
+
|
|
640
|
+
Returns:
|
|
641
|
+
Complete report as string
|
|
642
|
+
"""
|
|
643
|
+
self.on_start(root)
|
|
644
|
+
root.visit(self)
|
|
645
|
+
self.on_end()
|
|
646
|
+
return "\n".join(self.lines)
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
def build_tree_from_coverage(cov: Any, base_dir: str) -> CoverageNode:
|
|
650
|
+
"""Build a coverage tree from coverage.py data.
|
|
651
|
+
|
|
652
|
+
Args:
|
|
653
|
+
cov: Coverage object
|
|
654
|
+
base_dir: Base directory for relative paths
|
|
655
|
+
|
|
656
|
+
Returns:
|
|
657
|
+
Root coverage node
|
|
658
|
+
"""
|
|
659
|
+
root: CoverageNode = CoverageNode("")
|
|
660
|
+
|
|
661
|
+
data: Any = cov.get_data()
|
|
662
|
+
files: List[str] = sorted(data.measured_files())
|
|
663
|
+
|
|
664
|
+
for filename in files:
|
|
665
|
+
if filename.startswith(base_dir):
|
|
666
|
+
rel_path: str = filename[len(base_dir) :].lstrip("/")
|
|
667
|
+
else:
|
|
668
|
+
rel_path = filename
|
|
669
|
+
|
|
670
|
+
parts: List[str] = rel_path.split("/")
|
|
671
|
+
|
|
672
|
+
current: CoverageNode = root
|
|
673
|
+
for i, part in enumerate(parts):
|
|
674
|
+
if part not in current.children:
|
|
675
|
+
current.children[part] = CoverageNode(part, current)
|
|
676
|
+
current = current.children[part]
|
|
677
|
+
|
|
678
|
+
if i == len(parts) - 1:
|
|
679
|
+
current.is_file = True
|
|
680
|
+
current.file_data = cov.analysis2(filename)
|
|
681
|
+
|
|
682
|
+
return root
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
# noinspection PyUnusedLocal
|
|
686
|
+
@pytest.hookimpl(trylast=True)
|
|
687
|
+
def pytest_terminal_summary(terminalreporter: Any, exitstatus: int, config: Any) -> None:
|
|
688
|
+
"""Pytest hook to print a Jest-style coverage report.
|
|
689
|
+
|
|
690
|
+
Args:
|
|
691
|
+
terminalreporter: Pytest terminal reporter
|
|
692
|
+
exitstatus: Test exit status
|
|
693
|
+
config: Pytest config object
|
|
694
|
+
"""
|
|
695
|
+
if not config.pluginmanager.hasplugin("_cov"):
|
|
696
|
+
return
|
|
697
|
+
|
|
698
|
+
plugin: Any = config.pluginmanager.getplugin("_cov")
|
|
699
|
+
|
|
700
|
+
if not hasattr(plugin, "cov_controller") or not plugin.cov_controller:
|
|
701
|
+
return
|
|
702
|
+
|
|
703
|
+
cov: Any = plugin.cov_controller.cov
|
|
704
|
+
if not cov:
|
|
705
|
+
return
|
|
706
|
+
|
|
707
|
+
data: Any = cov.get_data()
|
|
708
|
+
files: List[str] = sorted(data.measured_files())
|
|
709
|
+
|
|
710
|
+
if not files:
|
|
711
|
+
return
|
|
712
|
+
|
|
713
|
+
base_dir: str = os.path.commonpath(files) if files else os.getcwd()
|
|
714
|
+
|
|
715
|
+
root: CoverageNode = build_tree_from_coverage(cov, base_dir)
|
|
716
|
+
|
|
717
|
+
try:
|
|
718
|
+
max_cols: int = shutil.get_terminal_size().columns
|
|
719
|
+
except (AttributeError, ValueError, OSError):
|
|
720
|
+
max_cols = 120
|
|
721
|
+
|
|
722
|
+
report: TextReport = TextReport(max_cols=max_cols)
|
|
723
|
+
report.has_branch_coverage = data.has_arcs()
|
|
724
|
+
|
|
725
|
+
output: str = report.execute(root)
|
|
726
|
+
|
|
727
|
+
terminalreporter.write("\n")
|
|
728
|
+
for line in output.split("\n"):
|
|
729
|
+
terminalreporter.write_line(line)
|
better_coverage/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: better-coverage
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Pytest reporter displaying pytest-cov coverage in Jest/Istanbul format with directory tree
|
|
5
|
+
Author-email: Mridang Agarwalla <mridang.agarwalla@gmail.com>
|
|
6
|
+
Maintainer-email: Mridang Agarwalla <mridang.agarwalla@gmail.com>
|
|
7
|
+
License: Apache-2.0
|
|
8
|
+
Project-URL: homepage, https://github.com/mridang/pytest-reporters
|
|
9
|
+
Project-URL: repository, https://github.com/mridang/pytest-reporters
|
|
10
|
+
Project-URL: documentation, https://github.com/mridang/pytest-reporters
|
|
11
|
+
Project-URL: Bug Tracker, https://github.com/mridang/pytest-reporters/issues
|
|
12
|
+
Keywords: pytest,coverage,istanbul,jest,reporter,pytest-plugin,coverage-reporter
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
14
|
+
Classifier: Framework :: Pytest
|
|
15
|
+
Requires-Python: !=3.9.0,!=3.9.1,>=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: pytest>=7.0.0
|
|
19
|
+
Requires-Dist: pytest-cov>=2.8.1
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# better_coverage
|
|
23
|
+
|
|
24
|
+
**better_coverage** is a pytest plugin that displays pytest-cov coverage results in Jest/Istanbul's console format with a directory tree structure.
|
|
25
|
+
|
|
26
|
+
##### Why?
|
|
27
|
+
|
|
28
|
+
Using better_coverage lets you see coverage in Jest's familiar table format right in your terminal. The reporter organizes files into a directory tree, shows uncovered line ranges (e.g., `5-12,18`), and applies the same color coding as Jest so your Python coverage reports look exactly like your JavaScript ones.
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
Add the package to your project:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install better-coverage
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Then run your tests with coverage:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pytest --cov=your_package --cov-report=xml
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The Jest-style coverage table will automatically appear at the end of your test run.
|
|
45
|
+
|
|
46
|
+
#### Options
|
|
47
|
+
|
|
48
|
+
The plugin automatically detects terminal width and formats output accordingly. Coverage data is read from pytest-cov, so use standard pytest-cov options:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pytest --cov=your_package --cov-report=xml --cov-branch
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Use `--cov-branch` to enable branch coverage reporting.
|
|
55
|
+
|
|
56
|
+
## Contributing
|
|
57
|
+
|
|
58
|
+
Contributions are welcome! If you find a bug or have suggestions for improvement, please open an issue or submit a pull request.
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
Apache License 2.0 © 2025 Mridang Agarwalla
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
better_coverage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
better_coverage/plugin.py,sha256=XOKV4nKI7z1L-RcY2NxdqJqXQ8TxghDHKAnQBrgiQio,20919
|
|
3
|
+
better_coverage/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
better_coverage-1.0.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
|
+
better_coverage-1.0.0.dist-info/METADATA,sha256=xO7Xode1YfckB1CrsXQ3jByFetIbMPbtEBQV3ihIGy0,2203
|
|
6
|
+
better_coverage-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
better_coverage-1.0.0.dist-info/entry_points.txt,sha256=yUIExqi0rkUtokoEEEyq5rMiJrISakPHJ-WGZ4xLhPA,52
|
|
8
|
+
better_coverage-1.0.0.dist-info/top_level.txt,sha256=i8I_bjul_y1Do8S6ph7S7b4QtqXjZExwX--mo2X9Ayw,16
|
|
9
|
+
better_coverage-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
better_coverage
|