Skip to content

Commit 2723538

Browse files
committed
Exclude solitary line from coverage
It's silly, because Python 3.5 and onwards allows coverage.py to detect this but otherwise our test coverage will fail.
1 parent 2cdfd8e commit 2723538

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[report]
22
exclude_lines =
33
.* # Python \d.*
4+
.* # nocov: Python \d.*
45
fail_under = 100

src/rfc3986/validators.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,10 @@ def ensure_components_are_valid(uri, validated_components):
415415
if component in _SUBAUTHORITY_VALIDATORS:
416416
if not subauthority_component_is_valid(uri, component):
417417
invalid_components.add(component)
418-
continue
418+
# Python's peephole optimizer means that while this continue *is*
419+
# actually executed, coverage.py cannot detect that. See also,
420+
# https://bitbucket.org/ned/coveragepy/issues/198/continue-marked-as-not-covered
421+
continue # nocov: Python 2.7, 3.3, 3.4
419422

420423
validator = _COMPONENT_VALIDATORS[component]
421424
if not validator(getattr(uri, component)):

0 commit comments

Comments
 (0)