Skip to content

Commit

Permalink
fix for coverage reports w/ absolute file path (#69)
Browse files Browse the repository at this point in the history
fix for coverage reports w/ absolute file path
  • Loading branch information
peterg79 authored and Bachmann1234 committed Dec 20, 2017
1 parent eee9239 commit 66d5fef
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
12/19/2017 v1.0.2

* Fix bug where clover uses absolute path in its xml report

12/08/2017 v1.0.1

* Add Support for clover and checkstyle
Expand Down
2 changes: 1 addition & 1 deletion diff_cover/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VERSION = '1.0.1'
VERSION = '1.0.2'
DESCRIPTION = 'Automatically find diff lines that need test coverage.'
QUALITY_DESCRIPTION = 'Automatically find diff lines with quality violations.'
4 changes: 4 additions & 0 deletions diff_cover/command_runner.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
import six
import subprocess

Expand Down Expand Up @@ -38,6 +39,9 @@ def execute(command):
raise

stderr = _ensure_unicode(stderr)
# after version 1.8.0 pylint writes a message to stderr:
# Using config file {}
stderr = re.sub(r'^Using config file .*$', '', stderr).strip()
# If we get a non-empty output to stderr, raise an exception
if bool(stderr) and process.returncode:
raise CommandError(stderr)
Expand Down
2 changes: 1 addition & 1 deletion diff_cover/tests/test_java_violations_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CloverXmlCoverageReporterTest(unittest.TestCase):

def setUp(self):
# Paths generated by git_path are always the given argument
_git_path_mock = patch('diff_cover.violationsreporters.violations_reporter.GitPathTool').start()
_git_path_mock = patch('diff_cover.violationsreporters.java_violations_reporter.GitPathTool').start()
_git_path_mock.relative_path = lambda path: path
_git_path_mock.absolute_path = lambda path: path

Expand Down
2 changes: 1 addition & 1 deletion diff_cover/violationsreporters/java_violations_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def _get_src_path_line_nodes(xml_document, src_path):
"""
files = [file_tree
for file_tree in xml_document.findall(".//file")
if file_tree.get('path') == src_path
if GitPathTool.relative_path(file_tree.get('path')) == src_path
or []]
if not files:
return None
Expand Down

0 comments on commit 66d5fef

Please sign in to comment.