Skip to content

Commit b2ca4e5

Browse files
tomschrscls19fr
authored andcommitted
Improve code coverage (python-semver#165)
* Add test for (private) _increment_string() function * Adapt .coveragerc: * Introduce option precision * Disable coverage for cmp * Update CHANGELOG.rst
1 parent 4bc39a2 commit b2ca4e5

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

.coveragerc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ source = semver
55
branch = True
66

77
[report]
8+
show_missing = true
9+
precision = 1
810
exclude_lines =
911
pragma: no cover
1012
if __name__ == .__main__.:
13+
if not hasattr\(__builtins__, .cmp.\):

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Features
2424
* :gh:`142` (:pr:`143`): Improved usage section
2525
* :gh:`145` (:pr:`146`): Added posargs in :file:`tox.ini`
2626
* :pr:`157`: Introduce :file:`conftest.py` to improve doctests
27+
* :pr:`165`: Improved code coverage
2728
* :pr:`166`: Reworked :file:`.gitignore` file
2829
* :gh:`167` (:pr:`168`): Introduced global constant :data:`SEMVER_SPEC_VERSION`
2930

test_semver.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@
2323
]
2424

2525

26+
@pytest.mark.parametrize("string,expected", [
27+
("rc", "rc"),
28+
("rc.1", "rc.2"),
29+
("2x", "3x"),
30+
])
31+
def test_should_private_increment_string(string, expected):
32+
from semver import _increment_string
33+
assert _increment_string(string) == expected
34+
35+
2636
@pytest.fixture
2737
def version():
2838
return VersionInfo(major=1, minor=2, patch=3,

0 commit comments

Comments
 (0)