From f7826a766739ab4834998ab2d2627086f636f4f7 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Mon, 1 Feb 2021 15:51:04 -0300 Subject: [PATCH] Added tests to cover missing lines in out_pdf_pcb_print.py --- tests/test_plot/test_misc.py | 9 ++++++++- tests/test_plot/test_yaml_errors.py | 11 +++++++++-- .../error_wrong_drill_marks_2.kibot.yaml | 19 +++++++++++++++++++ tests/yaml_samples/makefile_1.kibot.yaml | 14 ++++++++++++++ 4 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 tests/yaml_samples/error_wrong_drill_marks_2.kibot.yaml diff --git a/tests/test_plot/test_misc.py b/tests/test_plot/test_misc.py index 195d7c1d..89ba4adc 100644 --- a/tests/test_plot/test_misc.py +++ b/tests/test_plot/test_misc.py @@ -46,7 +46,8 @@ from kibot.misc import (EXIT_BAD_ARGS, EXIT_BAD_CONFIG, NO_PCB_FILE, NO_SCH_FILE POS_DIR = 'positiondir' -MK_TARGETS = ['position', 'archive', 'interactive_bom', 'run_erc', '3D', 'kibom_internal', 'drill', 'pcb_render'] +MK_TARGETS = ['position', 'archive', 'interactive_bom', 'run_erc', '3D', 'kibom_internal', 'drill', 'pcb_render', + 'print_front'] def test_skip_pre_and_outputs(test_dir): @@ -596,6 +597,12 @@ def test_makefile_1(test_dir): assert ctx.get_out_path(prj+'-top$.svg') in deps assert os.path.abspath(targets[targets['pcb_render']]) == ctx.board_file logging.debug('- Target `pcb_render` OK') + # print_front target + deps = targets['print_front'].split(' ') + assert len(deps) == 1, deps + assert ctx.get_out_path(prj+'-F_Cu+F_SilkS.pdf') in deps + assert os.path.abspath(targets[targets['print_front']]) == ctx.board_file + logging.debug('- Target `print_front` OK') # drill target deps = targets['drill'].split(' ') assert len(deps) == 3, deps diff --git a/tests/test_plot/test_yaml_errors.py b/tests/test_plot/test_yaml_errors.py index 706d01da..0d70c0a5 100644 --- a/tests/test_plot/test_yaml_errors.py +++ b/tests/test_plot/test_yaml_errors.py @@ -445,8 +445,15 @@ def test_error_gerber_precision(test_dir): ctx.clean_up() -def test_error_wrong_drill_marks(test_dir): - ctx = context.TestContext(test_dir, 'WrongDrillMarks', PRJ, 'error_wrong_drill_marks', '') +def test_error_wrong_drill_marks_1(test_dir): + ctx = context.TestContext(test_dir, 'test_error_wrong_drill_marks_1', PRJ, 'error_wrong_drill_marks', '') + ctx.run(EXIT_BAD_CONFIG) + assert ctx.search_err("Unknown drill mark type: bogus") + ctx.clean_up() + + +def test_error_wrong_drill_marks_2(test_dir): + ctx = context.TestContext(test_dir, 'test_error_wrong_drill_marks_2', PRJ, 'error_wrong_drill_marks_2', '') ctx.run(EXIT_BAD_CONFIG) assert ctx.search_err("Unknown drill mark type: bogus") ctx.clean_up() diff --git a/tests/yaml_samples/error_wrong_drill_marks_2.kibot.yaml b/tests/yaml_samples/error_wrong_drill_marks_2.kibot.yaml new file mode 100644 index 00000000..a2ca7471 --- /dev/null +++ b/tests/yaml_samples/error_wrong_drill_marks_2.kibot.yaml @@ -0,0 +1,19 @@ +# Example KiBot config file +kibot: + version: 1 + +outputs: + - name: 'print_front' + comment: "Print F.Cu+F.SilkS" + type: pdf_pcb_print + options: + scaling: 4 + drill_marks: bogus + plot_sheet_reference: false + monochrome: true + separated: true + mirror: true + layers: + - layer: F.Cu + - layer: F.SilkS + diff --git a/tests/yaml_samples/makefile_1.kibot.yaml b/tests/yaml_samples/makefile_1.kibot.yaml index 633504e2..1fb65046 100644 --- a/tests/yaml_samples/makefile_1.kibot.yaml +++ b/tests/yaml_samples/makefile_1.kibot.yaml @@ -59,6 +59,20 @@ outputs: options: output: '%f-%i$.%x' + - name: 'print_front' + comment: "Print F.Cu+F.SilkS" + type: pdf_pcb_print + options: + scaling: 4 + drill_marks: none + plot_sheet_reference: false + monochrome: true + separated: true + mirror: true + layers: + - layer: F.Cu + - layer: F.SilkS + - name: 'archive' comment: 'Compressed files' type: compress