diff --git a/kiplot/out_any_layer.py b/kiplot/out_any_layer.py index e0953d92..0d342853 100644 --- a/kiplot/out_any_layer.py +++ b/kiplot/out_any_layer.py @@ -77,7 +77,8 @@ class AnyLayerOptions(BaseOptions): # Plot single layer to file logger.debug("Opening plot file for layer `{}` format `{}`".format(l, self._plot_format)) if not plot_ctrl.OpenPlotfile(suffix, self._plot_format, desc): - raise PlotError("OpenPlotfile failed!") + # Shouldn't happen + raise PlotError("OpenPlotfile failed!") # pragma: no cover logger.debug("Plotting layer `{}` to `{}`".format(l, plot_ctrl.GetPlotFileName())) plot_ctrl.PlotLayer() diff --git a/kiplot/pre_base.py b/kiplot/pre_base.py index 6d67bef4..971dbc14 100644 --- a/kiplot/pre_base.py +++ b/kiplot/pre_base.py @@ -70,8 +70,8 @@ class BasePreFlight(object): def disable(self): self._enabled = False - def is_enabled(self): - return self._enabled + # def is_enabled(self): + # return self._enabled def __str__(self): return "{}: {}".format(self._name, self._enabled) diff --git a/kiplot/pre_drc.py b/kiplot/pre_drc.py index 56aed63e..7e5c8d6b 100644 --- a/kiplot/pre_drc.py +++ b/kiplot/pre_drc.py @@ -41,5 +41,5 @@ class Run_DRC(BasePreFlight): # noqa: F821 if ret < 0: logger.error('DRC errors: %d', -ret) else: - logger.error('DRC returned %d', ret) # pragma: no cover + logger.error('DRC returned %d', ret) exit(DRC_ERROR) diff --git a/tests/test_plot/test_yaml_errors.py b/tests/test_plot/test_yaml_errors.py index 0cf7cae0..895b8a59 100644 --- a/tests/test_plot/test_yaml_errors.py +++ b/tests/test_plot/test_yaml_errors.py @@ -351,6 +351,14 @@ def test_error_wrong_type_4(): ctx.clean_up() +def test_error_wrong_type_5(): + """ check_zone_fills = number """ + ctx = context.TestContext('ErrorWrongType5', PRJ, 'error_pre_wrong_type_5', '') + ctx.run(EXIT_BAD_CONFIG) + assert ctx.search_err("In preflight 'check_zone_fills': must be boolean") + ctx.clean_up() + + def test_error_yaml(): ctx = context.TestContext('ErrorYAML', PRJ, 'error_yaml', '') ctx.run(EXIT_BAD_CONFIG) @@ -384,3 +392,17 @@ def test_error_bom_wrong_format(): ctx.run(EXIT_BAD_CONFIG) assert ctx.search_err("Option .?format.? must be any of") ctx.clean_up() + + +def test_error_gerber_precision(): + ctx = context.TestContext('GerberPrecisionError', PRJ, 'error_gerber_precision', '') + ctx.run(EXIT_BAD_CONFIG) + assert ctx.search_err(".?gerber_precision.? must be 4.5 or 4.6") + ctx.clean_up() + + +def test_error_wrong_drill_marks(): + ctx = context.TestContext('WrongDrillMarks', PRJ, 'error_wrong_drill_marks', '') + ctx.run(EXIT_BAD_CONFIG) + assert ctx.search_err("Unknown drill mark type: bogus") + ctx.clean_up() diff --git a/tests/yaml_samples/error_gerber_precision.kiplot.yaml b/tests/yaml_samples/error_gerber_precision.kiplot.yaml new file mode 100644 index 00000000..788d953b --- /dev/null +++ b/tests/yaml_samples/error_gerber_precision.kiplot.yaml @@ -0,0 +1,36 @@ +# Example KiPlot config file for a basic 2-layer board +kiplot: + version: 1 + +outputs: + + - name: 'gerbers' + comment: "Gerbers for the Gerber god" + type: gerber + dir: gerberdir + options: + # generic layer options + exclude_edge_layer: false + exclude_pads_from_silkscreen: false + use_aux_axis_as_origin: false + plot_sheet_reference: false + plot_footprint_refs: true + plot_footprint_values: true + force_plot_invisible_refs_vals: false + tent_vias: true + + # gerber options + line_width: 0.15 + subtract_mask_from_silk: true + use_protel_extensions: false + gerber_precision: 4.7 + create_gerber_job_file: true + use_gerber_x2_attributes: true + use_gerber_net_attributes: false + + layers: + - layer: F.Cu + suffix: F_Cu + - layer: F.SilkS + suffix: F_SilkS + diff --git a/tests/yaml_samples/error_pre_wrong_type_5.kiplot.yaml b/tests/yaml_samples/error_pre_wrong_type_5.kiplot.yaml new file mode 100644 index 00000000..6edb2f62 --- /dev/null +++ b/tests/yaml_samples/error_pre_wrong_type_5.kiplot.yaml @@ -0,0 +1,10 @@ +# Example KiPlot config file +kiplot: + version: 1 + +preflight: + update_xml: true + run_erc: true + check_zone_fills: Hi! + + diff --git a/tests/yaml_samples/error_wrong_drill_marks.kiplot.yaml b/tests/yaml_samples/error_wrong_drill_marks.kiplot.yaml new file mode 100644 index 00000000..f5cda614 --- /dev/null +++ b/tests/yaml_samples/error_wrong_drill_marks.kiplot.yaml @@ -0,0 +1,30 @@ +kiplot: + version: 1 + +outputs: + - name: DXF + comment: "DXF files" + type: dxf + dir: DXF + options: + exclude_edge_layer: false + exclude_pads_from_silkscreen: false + use_aux_axis_as_origin: false + plot_sheet_reference: false + plot_footprint_refs: true + plot_footprint_values: true + force_plot_invisible_refs_vals: false + tent_vias: true + + # DXF options + drill_marks: bogus + sketch_plot: false + use_aux_axis_as_origin: false + polygon_mode: true + metric_units: false + layers: + - layer: F.Cu + suffix: F_Cu + - layer: F.Fab + suffix: F_Fab +