-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from nicoddemus/diff-opt
Implement --diff-range-notation option
- Loading branch information
Showing
11 changed files
with
121 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from __future__ import unicode_literals | ||
|
||
import pytest | ||
|
||
from diff_cover.diff_cover_tool import parse_coverage_args | ||
|
||
|
||
class TestParseCoverArgsTest: | ||
|
||
def test_parse_coverage_xml(self): | ||
argv = ['build/tests/coverage.xml', '--compare-branch=origin/other'] | ||
|
||
arg_dict = parse_coverage_args(argv) | ||
|
||
assert arg_dict['coverage_xml'] == ['build/tests/coverage.xml'] | ||
assert arg_dict['compare_branch'] == 'origin/other' | ||
assert arg_dict['diff_range_notation'] == '...' | ||
|
||
def test_parse_range_notation(self, capsys): | ||
argv = ['build/tests/coverage.xml', '--diff-range-notation=..'] | ||
|
||
arg_dict = parse_coverage_args(argv) | ||
|
||
assert arg_dict['coverage_xml'] == ['build/tests/coverage.xml'] | ||
assert arg_dict['diff_range_notation'] == '..' | ||
|
||
with pytest.raises(SystemExit) as e: | ||
argv = ['build/tests/coverage.xml', '--diff-range-notation=FOO'] | ||
parse_coverage_args(argv) | ||
|
||
assert e.value.code == 2 | ||
_, err = capsys.readouterr() | ||
assert "invalid choice: 'FOO'" in err |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters