Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

Commit

Permalink
Simplify the no-coverage marker.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilk committed Dec 19, 2016
1 parent d939125 commit 899d675
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 26 deletions.
3 changes: 1 addition & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ branch = true

[report]
show_missing = true
exclude_lines =
<no-coverage>
exclude_lines = # no coverage

# vim:ft=dosini
4 changes: 2 additions & 2 deletions lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import sys

if sys.version_info < (2, 6): # <no-coverage>
if sys.version_info < (2, 6): # no coverage
raise RuntimeError('Python >= 2.6 is required')
if sys.version_info >= (3, 0): # <no-coverage>
if sys.version_info >= (3, 0): # no coverage
raise RuntimeError('Python 2.X is required')

# vim:ts=4 sts=4 sw=4 et
2 changes: 1 addition & 1 deletion lib/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

try:
import argparse
except ImportError as ex: # <no-coverage>
except ImportError as ex: # no coverage
utils.enhance_import_error(ex, 'argparse', 'python-argparse', 'https://pypi.python.org/pypi/argparse')
raise

Expand Down
6 changes: 3 additions & 3 deletions lib/cli/djvu2hocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ def bbox(self):
@property
def text(self):
if len(self._sexpr) != 6:
raise TypeError('list of {0} (!= 6) elements'.format(len(self._sexpr))) # <no-coverage>
raise TypeError('list of {0} (!= 6) elements'.format(len(self._sexpr))) # no coverage
if not isinstance(self._sexpr[5], sexpr.StringExpression):
raise TypeError('last element is not a string') # <no-coverage>
raise TypeError('last element is not a string') # no coverage
return unicode(self._sexpr[5].value, 'UTF-8', 'replace')

@property
Expand All @@ -111,7 +111,7 @@ def children(self):
def n_children(self):
n = len(self._sexpr) - 5
if n <= 0:
raise TypeError('list of {0} (< 6) elements'.format(len(self._sexpr))) # <no-coverage>
raise TypeError('list of {0} (< 6) elements'.format(len(self._sexpr))) # no coverage
return n

def __repr__(self):
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/ocrodjvu.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Saver(object):

@utils.not_overridden
def save(self, document, pages, djvu_path, sed_file):
raise NotImplementedError('Cannot save results in this format') # <no-coverage>
raise NotImplementedError('Cannot save results in this format') # no coverage

class BundledSaver(Saver):

Expand Down
6 changes: 3 additions & 3 deletions lib/engines/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class Engine(object):
def __init__(self, *args, **kwargs):
tpname = '{mod}.{tp}'.format(tp=type(self).__name__, mod=self.__module__)
if args:
raise ValueError('{tp}.__init__() takes no positional arguments'.format(tp=tpname)) # <no-coverage>
raise ValueError('{tp}.__init__() takes no positional arguments'.format(tp=tpname)) # no coverage
if not isinstance(self.name, str):
raise TypeError('{tp}.name must be a string'.format(tp=tpname)) # <no-coverage>
raise TypeError('{tp}.name must be a string'.format(tp=tpname)) # no coverage
if not issubclass(self.image_format, image_io.ImageFormat):
raise TypeError('{tp}.image_format must be an ImageFormat subclass'.format(tp=tpname)) # <no-coverage>
raise TypeError('{tp}.image_format must be an ImageFormat subclass'.format(tp=tpname)) # no coverage
for key, value in kwargs.iteritems():
try:
prop = getattr(type(self), key)
Expand Down
2 changes: 1 addition & 1 deletion lib/html5_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
def parse(stream):
try:
import html5lib
except ImportError as ex: # <no-coverage>
except ImportError as ex: # no coverage
utils.enhance_import_error(ex, 'html5lib', 'python-html5lib', 'https://github.com/html5lib/html5lib-python')
raise
return html5lib.parse(stream,
Expand Down
6 changes: 3 additions & 3 deletions lib/ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
thread_safe = True
try:
import subprocess32 as subprocess
except ImportError: # <no-coverage>
except ImportError: # no coverage
import subprocess
if os.name == 'posix':
thread_safe = False
Expand All @@ -46,12 +46,12 @@ def get_signal_names():
try:
if data['SIGABRT'] == data['SIGIOT']:
del data['SIGIOT']
except KeyError: # <no-coverage>
except KeyError: # no coverage
pass
try:
if data['SIGCHLD'] == data['SIGCLD']:
del data['SIGCLD']
except KeyError: # <no-coverage>
except KeyError: # no coverage
pass
return dict((no, name) for name, no in data.iteritems())

Expand Down
4 changes: 2 additions & 2 deletions lib/text_zones.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from djvu.dllpath import set_dll_search_path
except ImportError:
pass
else: # <no-coverage>
else: # no coverage
set_dll_search_path()

from . import utils
Expand All @@ -25,7 +25,7 @@
from djvu import const
from djvu import decode
from djvu import sexpr
except ImportError as ex: # <no-coverage>
except ImportError as ex: # no coverage
utils.enhance_import_error(ex, 'python-djvulibre', 'python-djvu', 'http://jwilk.net/software/python-djvulibre')
raise

Expand Down
2 changes: 1 addition & 1 deletion lib/unicode_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
def get_icu():
try:
import icu
except ImportError: # <no-coverage>
except ImportError: # no coverage
utils.enhance_import_error(ex, 'PyICU', 'python-pyicu', 'https://pypi.python.org/pypi/PyICU/')
else:
return icu
Expand Down
6 changes: 3 additions & 3 deletions lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ def get_cpu_count():
try:
import multiprocessing
return multiprocessing.cpu_count()
except (ImportError, NotImplementedError): # <no-coverage>
except (ImportError, NotImplementedError): # no coverage
pass
try: # <no-coverage>
try: # no coverage
return os.sysconf('SC_NPROCESSORS_ONLN')
except (ValueError, OSError, AttributeError): # <no-coverage>
except (ValueError, OSError, AttributeError): # no coverage
return 1

# vim:ts=4 sts=4 sw=4 et
8 changes: 4 additions & 4 deletions lib/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,26 @@ def __call__(self, parser, namespace, values, option_string=None):
print('+ subprocess32')
try:
djvu_decode = sys.modules['djvu.decode']
except LookupError: # <no-coverage>
except LookupError: # no coverage
pass
else:
print('+ python-djvulibre {0}'.format(djvu_decode.__version__))
try:
lxml_etree = sys.modules['lxml.etree']
except LookupError: # <no-coverage>
except LookupError: # no coverage
pass
else:
print('+ lxml {0}'.format(lxml_etree.__version__))
try:
import html5lib
except ImportError: # <no-coverage>
except ImportError: # no coverage
pass
else:
print('+ html5lib-python {0}'.format(html5lib.__version__))
try:
from . import unicode_support
pyicu = unicode_support.get_icu()
except ImportError: # <no-coverage>
except ImportError: # no coverage
pass
else:
print('+ PyICU {0}'.format(pyicu.VERSION))
Expand Down

0 comments on commit 899d675

Please sign in to comment.