Skip to content

Commit

Permalink
feat(deps): add support for coverage v7.5+
Browse files Browse the repository at this point in the history
  • Loading branch information
TheKevJames committed May 15, 2024
1 parent afea549 commit afbcd95
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 72 deletions.
16 changes: 11 additions & 5 deletions coveralls/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,15 @@ def get_arcs(analysis: Analysis) -> List[int]:
3. branch-number
4. hits (we only get 1/0 from coverage.py)
"""
if not analysis.has_arcs():
# pylint: disable=too-complex
has_arcs: bool
try:
has_arcs = analysis.has_arcs()
except TypeError:
# coverage v7.5+
has_arcs = analysis.has_arcs

if not has_arcs:
return []

missing_arcs: Dict[int, List[int]] = analysis.missing_branch_arcs()
Expand Down Expand Up @@ -120,17 +128,15 @@ def parse_file(self, cu: FileReporter, analysis: Analysis) -> None:
posix_filename = posix_filename[len(self.base_dir):]
posix_filename = self.src_dir + posix_filename

source = analysis.file_reporter.source()

token_lines = analysis.file_reporter.source_token_lines()
token_lines = cu.source_token_lines()
coverage_lines = [
self.get_hits(i, analysis)
for i, _ in enumerate(token_lines, 1)
]

results = {
'name': posix_filename,
'source': source,
'source': cu.source(),
'coverage': coverage_lines,
}

Expand Down
Loading

0 comments on commit afbcd95

Please sign in to comment.