Removed coverage exclusions for KiCad 6 code

This commit is contained in:
Salvador E. Tropea 2022-02-11 12:58:39 -03:00
parent b37295af69
commit d7430499d2
8 changed files with 17 additions and 17 deletions

View File

@ -108,7 +108,7 @@ def solve_schematic(a_schematic, a_board_file, config):
else:
sch = base+'.kicad_sch'
if os.path.isfile(sch):
schematic = sch # pragma: no cover (Ki6)
schematic = sch
if not schematic:
schematics = glob('*.sch')+glob('*.kicad_sch')
if len(schematics) == 1:
@ -219,7 +219,7 @@ def set_locale():
def detect_kicad():
# Check if we have to run the nightly KiCad build
nightly = False
if os.environ.get('KIAUS_USE_NIGHTLY'): # pragma: no cover (Ki6)
if os.environ.get('KIAUS_USE_NIGHTLY'): # pragma: no cover (nightly)
# Path to the Python module
pcbnew_path = '/usr/lib/kicad-nightly/lib/python3/dist-packages'
sys_path.insert(0, pcbnew_path)
@ -263,7 +263,7 @@ def detect_kicad():
# KICAD_PATH isn't good on my system.
# The kicad-nightly package overwrites the regular package!!
GS.kicad_share_path = '/usr/share/kicad'
if GS.ki6(): # pragma: no cover (Ki6)
if GS.ki6():
GS.kicad_conf_path = pcbnew.GetSettingsManager().GetUserSettingsPath()
if nightly:
# Nightly Debian packages uses `/usr/share/kicad-nightly/kicad-nightly.env` as an environment extension

View File

@ -147,7 +147,7 @@ class GS(object):
@staticmethod
def get_pcb_comment(title_block, num):
if GS.ki6(): # pragma: no cover (Ki6)
if GS.ki6():
# Backward compatibility ... what's this?
# Also: Maintaining the same numbers used before (and found in the file) is asking too much?
return title_block.GetComment(num)
@ -163,13 +163,13 @@ class GS(object):
@staticmethod
def get_modules():
if GS.ki6(): # pragma: no cover (Ki6)
if GS.ki6():
return GS.board.GetFootprints()
return GS.board.GetModules()
@staticmethod
def get_modules_board(board):
if GS.ki6(): # pragma: no cover (Ki6)
if GS.ki6():
return board.GetFootprints()
return board.GetModules()
@ -177,7 +177,7 @@ class GS(object):
def get_aux_origin():
if GS.board is None:
return (0, 0)
if GS.ki6(): # pragma: no cover (Ki6)
if GS.ki6():
settings = GS.board.GetDesignSettings()
return settings.GetAuxOrigin()
return GS.board.GetAuxOrigin()

View File

@ -289,7 +289,7 @@ def get_board_comps_data(comps):
c.virtual = True
else:
c.tht = True
else: # pragma: no cover (Ki6)
else:
# KiCad 6
if attrs & MOD_SMD:
c.smd = True

View File

@ -189,7 +189,7 @@ class Layer(Optionable):
elif layer in Layer._pcb_layers:
ext = [Layer.create_layer(layer)]
# Give compatibility for the KiCad 5 default names (automagically renamed by KiCad 6)
elif GS.ki6() and layer in Layer.KICAD6_RENAME: # pragma: no cover (Ki6)
elif GS.ki6() and layer in Layer.KICAD6_RENAME:
ext = [Layer.create_layer(Layer.KICAD6_RENAME[layer])]
elif layer in Layer.DEFAULT_LAYER_NAMES:
ext = [Layer.create_layer(layer)]

View File

@ -12,7 +12,7 @@ if not GS.kicad_version_n:
# When running the regression tests we need it
from kibot.__main__ import detect_kicad
detect_kicad()
if GS.ki6(): # pragma: no cover (Ki6)
if GS.ki6():
# New name, no alias ...
from pcbnew import FP_SHAPE, wxPoint, LSET
else:
@ -186,7 +186,7 @@ class VariantOptions(BaseOptions):
@staticmethod
def create_module_element(m):
if GS.ki6():
return FP_SHAPE(m) # pragma: no cover (Ki6)
return FP_SHAPE(m)
return EDGE_MODULE(m)
@staticmethod

View File

@ -8,7 +8,7 @@ from .out_any_layer import AnyLayer
from .drill_marks import DrillMarks
from .gs import GS
from .macros import macros, document, output_class # noqa: F401
if GS.ki6(): # pragma: no cover (Ki6)
if GS.ki6():
from pcbnew import DXF_UNITS_MILLIMETERS, DXF_UNITS_INCHES
else:
DXF_UNITS_MILLIMETERS = 1

View File

@ -64,7 +64,7 @@ class GerberOptions(AnyLayerOptions):
if GS.ki5():
po.SetLineWidth(FromMM(self.line_width))
else:
po.SetDisableGerberMacros(self.disable_aperture_macros) # pragma: no cover (Ki6)
po.SetDisableGerberMacros(self.disable_aperture_macros)
po.gerber_job_file = self.gerber_job_file
def read_vals_from_po(self, po):
@ -88,7 +88,7 @@ class GerberOptions(AnyLayerOptions):
self.line_width = ToMM(po.GetLineWidth())
else:
# disableapertmacros
self.disable_aperture_macros = po.GetDisableGerberMacros() # pragma: no cover (Ki6)
self.disable_aperture_macros = po.GetDisableGerberMacros()
@output_class

View File

@ -191,7 +191,7 @@ class PositionOptions(VariantOptions):
@staticmethod
def is_pure_smd_6(m):
return m.GetAttributes() & (MOD_THROUGH_HOLE | MOD_SMD) == MOD_SMD # pragma: no cover (Ki6)
return m.GetAttributes() & (MOD_THROUGH_HOLE | MOD_SMD) == MOD_SMD
@staticmethod
def is_not_virtual_5(m):
@ -199,13 +199,13 @@ class PositionOptions(VariantOptions):
@staticmethod
def is_not_virtual_6(m):
return not (m.GetAttributes() & MOD_EXCLUDE_FROM_POS_FILES) # pragma: no cover (Ki6)
return not (m.GetAttributes() & MOD_EXCLUDE_FROM_POS_FILES)
@staticmethod
def get_attr_tests():
if GS.ki5():
return PositionOptions.is_pure_smd_5, PositionOptions.is_not_virtual_5
return PositionOptions.is_pure_smd_6, PositionOptions.is_not_virtual_6 # pragma: no cover (Ki6)
return PositionOptions.is_pure_smd_6, PositionOptions.is_not_virtual_6
def get_targets(self, out_dir):
ext = self._expand_ext