Removed some "no cover" comments, clasified the rest

This commit is contained in:
Salvador E. Tropea 2021-02-01 08:53:24 -03:00
parent 8492786dcc
commit 7422e9726c
14 changed files with 28 additions and 28 deletions

View File

@ -86,8 +86,8 @@ def get_prefix(prefix):
# Unknown, we shouldn't get here because the regex matched
# BUT: I found that sometimes unexpected things happend, like mu matching micro and then we reaching this code
# Now is fixed, but I can't be sure some bizarre case is overlooked
logger.error('Unknown prefix, please report') # pragma: no cover
return 1, '' # pragma: no cover
logger.error('Unknown prefix, please report') # pragma: no cover (Internal)
return 1, '' # pragma: no cover (Internal)
def group_string(group): # Return a reg-ex string for a list of values

View File

@ -252,7 +252,7 @@ def print_output_options(name, cl, indent):
else:
entry = ' - `{}`: '
if help is None:
help = 'Undocumented' # pragma: no cover
help = 'Undocumented' # pragma: no cover (Internal)
lines = help.split('\n')
preface = ind_str+entry.format(k)
clines = len(lines)
@ -278,7 +278,7 @@ def print_output_options(name, cl, indent):
def print_one_out_help(details, n, o):
lines = trim(o.__doc__)
if len(lines) == 0:
lines = ['Undocumented', 'No description'] # pragma: no cover
lines = ['Undocumented', 'No description'] # pragma: no cover (Internal)
if details:
print('* '+lines[0])
print(' * Type: `{}`'.format(n))
@ -314,7 +314,7 @@ def print_preflights_help():
for n, o in OrderedDict(sorted(pres.items())).items():
help, options = o.get_doc()
if help is None:
help = 'Undocumented' # pragma: no cover
help = 'Undocumented' # pragma: no cover (Internal)
print('- {}: {}.'.format(n, help.strip()))
if options:
print_output_options(n, options, 2)
@ -327,7 +327,7 @@ def print_filters_help():
for n, o in OrderedDict(sorted(fils.items())).items():
help = o.__doc__
if help is None:
help = 'Undocumented' # pragma: no cover
help = 'Undocumented' # pragma: no cover (Internal)
print('- {}: {}.'.format(n, help.strip()))
print_output_options(n, o, 2)
@ -425,7 +425,7 @@ def create_example(pcb_file, out_dir, copy_options, copy_expand):
for n, cls in OrderedDict(sorted(outs.items())).items():
lines = trim(cls.__doc__)
if len(lines) == 0:
lines = ['Undocumented', 'No description'] # pragma: no cover
lines = ['Undocumented', 'No description'] # pragma: no cover (Internal)
f.write(' # '+lines[0].rstrip()+':\n')
for ln in range(2, len(lines)):
f.write(' # '+lines[ln].rstrip()+'\n')

View File

@ -31,7 +31,7 @@ class DrillMarks(AnyLayerOptions):
super().__init__()
with document:
self._drill_marks = 'full'
""" what to use to indicate the drill places, can be none, small or full (for real scale) """ # pragma: no cover
""" what to use to indicate the drill places, can be none, small or full (for real scale) """
@property
def drill_marks(self):

View File

@ -28,7 +28,7 @@ from ..misc import W_NOCONFIG, W_NOKIENV, W_NOLIBS, W_NODEFSYMLIB
# Check python version to determine which version of ConfirParser to import
if sys.version_info.major >= 3:
import configparser as ConfigParser
else: # pragma: no cover
else: # pragma: no cover (Py2)
# For future Python 2 support
import ConfigParser
@ -151,7 +151,7 @@ class KiConf(object):
dir = os.path.join(sysconfig.get_path('data', 'posix_prefix'), share)
if os.path.isdir(dir):
return dir
elif system == 'Darwin': # pragma: no cover
elif system == 'Darwin': # pragma: no cover (Darwin)
app_data = os.path.join('Library', 'Application Support', 'kicad', 'library')
home = os.environ.get('HOME')
if home:
@ -161,7 +161,7 @@ class KiConf(object):
dir = os.path.join('/', app_data)
if os.path.isdir(dir):
return dir
elif system == 'Windows': # pragma: no cover
elif system == 'Windows': # pragma: no cover (Windows)
dir = os.path.join('C:', 'Program Files', 'KiCad', share)
if os.path.isdir(dir):
return dir

View File

@ -1479,7 +1479,7 @@ class Schematic(object):
""" A list of all the components. """
if exclude_power:
components = [c for c in self.components if not c.is_power]
else: # pragma: no cover
else: # pragma: no cover (Internal)
# Currently unused
components = [c for c in self.components]
for sch in self.sheets:

View File

@ -189,7 +189,7 @@ class Layer(Optionable):
raise KiPlotConfigurationError("Unknown layer spec: `{}`".format(layer))
new_vals.extend(ext)
return new_vals
assert False, "Unimplemented layer type "+str(type(values)) # pragma: no cover
assert False, "Unimplemented layer type "+str(type(values)) # pragma: no cover (Internal)
@staticmethod
def _get_copper():

View File

@ -15,7 +15,7 @@ from io import StringIO
no_colorama = False
try:
from colorama import init as colorama_init, Fore, Back, Style
except ImportError: # pragma: no cover
except ImportError:
no_colorama = True
# If colorama isn't installed use an ANSI basic replacement
if no_colorama:

View File

@ -33,7 +33,7 @@ def document(sentences, **kw):
value = prev.value
# Extract its name
# variables and attributes are supported
if isinstance(target, Name): # pragma: no cover
if isinstance(target, Name): # pragma: no cover (Internal)
# Note: The support for variables isn't currently used
name = target.id
is_attr = False
@ -42,7 +42,7 @@ def document(sentences, **kw):
is_attr = True
else:
# Just in case we put anything other than an attr/var assignment
continue # pragma: no cover
continue # pragma: no cover (Internal)
# Remove starting underscore
if name[0] == '_':
name = name[1:]
@ -65,17 +65,17 @@ def document(sentences, **kw):
val = eval(unparse(value))
if isinstance(val, bool):
# Not used yet
type_hint = '[boolean={}]'.format(str(val).lower()) # pragma: no cover
type_hint = '[boolean={}]'.format(str(val).lower()) # pragma: no cover (Internal)
elif isinstance(val, (int, float)):
# Not used yet
type_hint = '[number={}]'.format(val) # pragma: no cover
type_hint = '[number={}]'.format(val) # pragma: no cover (Internal)
elif isinstance(val, str):
type_hint = "[string='{}']".format(val)
post_hint += '. Affected by global options'
# Transform the string into an assign for _help_ID
if is_attr:
target = Attribute(value=Name(id='self', ctx=Load()), attr=doc_id, ctx=Store())
else: # pragma: no cover
else: # pragma: no cover (Internal)
target = Name(id=doc_id, ctx=Store())
# Reuse the s.value Str
help_str = s.value
@ -102,7 +102,7 @@ def _do_wrap_class_register(tree, mod, base_class):
do_import = ImportFrom(module=mod, names=[alias(name=base_class, asname=None)], level=1)
return [do_import, tree, do_register]
# Just in case somebody applies it to anything other than a class
return tree # pragma: no cover
return tree # pragma: no cover (Internal)
def output_class(tree, **kw):

View File

@ -133,7 +133,7 @@ class Optionable(object):
if isinstance(v, (int, float)) and not isinstance(v, bool):
# Note: booleans are also instance of int
# Not used yet
Optionable._check_num(k, v, cur_doc) # pragma: no cover
Optionable._check_num(k, v, cur_doc) # pragma: no cover (Internal)
elif isinstance(v, str):
Optionable._check_str(k, v, cur_doc)
elif isinstance(v, dict):

View File

@ -156,7 +156,7 @@ class AnyLayerOptions(VariantOptions):
logger.debug("Opening plot file for layer `{}` format `{}`".format(la, self._plot_format))
if not plot_ctrl.OpenPlotfile(suffix, self._plot_format, desc):
# Shouldn't happen
raise PlotError("OpenPlotfile failed!") # pragma: no cover
raise PlotError("OpenPlotfile failed!") # pragma: no cover (Internal)
# Compute the current file name and the one we want
k_filename = plot_ctrl.GetPlotFileName()
filename = self.compute_name(k_filename, output_dir, self.output, id, suffix)

View File

@ -31,7 +31,7 @@ class BaseOutput(RegOutput):
self.dir = '.'
""" Output directory for the generated files """
self.comment = ''
""" A comment for documentation purposes """ # pragma: no cover
""" A comment for documentation purposes """
self._sch_related = False
self._unkown_is_error = True
self._done = False

View File

@ -34,7 +34,7 @@ class KiBoMRegex(Optionable):
self.field = None
""" {column} """
self.regexp = None
""" {regex} """ # pragma: no cover
""" {regex} """
def __str__(self):
return self.column+'\t'+self.regex
@ -51,7 +51,7 @@ class KiBoMColumns(Optionable):
self.name = ''
""" Name to display in the header. The field is used when empty """
self.join = Optionable
""" [list(string)|string=''] List of fields to join to this column """ # pragma: no cover
""" [list(string)|string=''] List of fields to join to this column """
self._field_example = 'Row'
self._name_example = 'Line'
@ -160,7 +160,7 @@ class KiBoMConfig(Optionable):
..regex: 'fiducial' """
self.columns = KiBoMColumns
""" [list(dict)|list(string)] List of columns to display.
Can be just the name of the field """ # pragma: no cover
Can be just the name of the field """
@staticmethod
def _create_minimal_ini():

View File

@ -123,7 +123,7 @@ class PDF_Pcb_PrintOptions(VariantOptions):
os.remove(board_name)
if proj_name:
os.remove(proj_name)
if ret: # pragma: no cover
if ret: # pragma: no cover (Internal)
# We check all the arguments, we even load the PCB
# A fail here isn't easy to reproduce
logger.error(CMD_PCBNEW_PRINT_LAYERS+' returned %d', ret)

View File

@ -231,7 +231,7 @@ class STEPOptions(VariantOptions):
logger.debug('Executing: '+str(cmd))
try:
cmd_output = check_output(cmd, stderr=STDOUT)
except CalledProcessError as e: # pragma: no cover
except CalledProcessError as e: # pragma: no cover (Internal)
# Current kicad2step always returns 0!!!!
# This is why I'm excluding it from coverage
logger.error('Failed to create Step file, error %d', e.returncode)