From 370b5bdaf6f3f46a812f7f56d41188c3faa71700 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Wed, 3 Feb 2021 10:23:15 -0300 Subject: [PATCH] Added test for run_drc to the makefile test. - Also test the schematic fallback for preflight deps. --- tests/test_plot/test_misc.py | 11 +++++++++-- tests/test_plot/test_misc_2.py | 10 ++++++++++ tests/yaml_samples/makefile_1.kibot.yaml | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/test_plot/test_misc.py b/tests/test_plot/test_misc.py index 32c721a5..7a5bdf9f 100644 --- a/tests/test_plot/test_misc.py +++ b/tests/test_plot/test_misc.py @@ -47,7 +47,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', - 'print_front', 'svg_sch_def', 'svg_sch_int', 'pdf_sch_def', 'pdf_sch_int', 'fake_sch', 'update_xml'] + 'print_front', 'svg_sch_def', 'svg_sch_int', 'pdf_sch_def', 'pdf_sch_int', 'fake_sch', 'update_xml', + 'run_drc'] def test_skip_pre_and_outputs(test_dir): @@ -647,13 +648,19 @@ def test_makefile_1(test_dir): assert ctx.get_out_path(prj+'-erc.txt') in deps check_test_v5_sch_deps(ctx, targets[targets['run_erc']].split(' ')) logging.debug('- Target `run_erc` OK') + # run_drc target + deps = targets['run_drc'].split(' ') + assert len(deps) == 1, deps + assert ctx.get_out_path(prj+'-drc.txt') in deps + assert os.path.abspath(targets[targets['run_drc']]) == ctx.board_file + logging.debug('- Target `run_drc` OK') # fake_sch target deps = targets['fake_sch'].split(' ') assert len(deps) == 6, deps check_test_v5_sch_deps(ctx, deps, extra=[ctx.get_out_path('n.lib'), ctx.get_out_path('y.lib'), ctx.get_out_path('sym-lib-table')], in_output=True) check_test_v5_sch_deps(ctx, targets[targets['fake_sch']].split(' ')) - logging.debug('- Target `run_erc` OK') + logging.debug('- Target `fake_sch` OK') # 3D target deps = targets['3D'].split(' ') assert len(deps) == 1, deps diff --git a/tests/test_plot/test_misc_2.py b/tests/test_plot/test_misc_2.py index c96da633..6c3c5025 100644 --- a/tests/test_plot/test_misc_2.py +++ b/tests/test_plot/test_misc_2.py @@ -14,6 +14,7 @@ prev_dir = os.path.dirname(prev_dir) if prev_dir not in sys.path: sys.path.insert(0, prev_dir) from kibot.out_base import BaseOutput +from kibot.pre_base import BasePreFlight from kibot.gs import GS from kibot.kiplot import load_actions, _import from kibot.registrable import RegOutput @@ -115,8 +116,15 @@ class NoGetTargets(BaseOutput): self._sch_related = True +class DummyPre(BasePreFlight): + def __init__(self): + super().__init__('dummy', True) + self._sch_related = True + + def test_no_get_targets(caplog): test = NoGetTargets() + test_pre = DummyPre() # Also check the dependencies fallback GS.sch = None GS.sch_file = 'fake' @@ -125,11 +133,13 @@ def test_no_get_targets(caplog): cov.start() test.get_targets('') files = test.get_dependencies() + files_pre = test_pre.get_dependencies() # Stop coverage cov.stop() cov.save() assert "Output 'Fake' (dummy) [none] doesn't implement get_targets(), plese report it" in caplog.text assert files == [GS.sch_file] + assert files_pre == [GS.sch_file] def test_ibom_parse_fail(test_dir, caplog, monkeypatch): diff --git a/tests/yaml_samples/makefile_1.kibot.yaml b/tests/yaml_samples/makefile_1.kibot.yaml index 60fbba9e..2ecd7f2a 100644 --- a/tests/yaml_samples/makefile_1.kibot.yaml +++ b/tests/yaml_samples/makefile_1.kibot.yaml @@ -3,6 +3,7 @@ kibot: preflight: run_erc: true + run_drc: true check_zone_fills: true update_xml: true