From 10f07064822bf6a98999248c3cba8a2667902f88 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Mon, 1 Feb 2021 16:39:10 -0300 Subject: [PATCH] Exclude KiCad 6 code and enabled coverage for out_base tests. --- Makefile | 1 + kibot/out_base.py | 4 ++-- tests/test_plot/test_misc_2.py | 13 ++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 580eb377..83058468 100644 --- a/Makefile +++ b/Makefile @@ -93,6 +93,7 @@ docker_shell: single_test: rm -rf pp + -$(PY_COV) run -a src/kibot --help-list-outputs > /dev/null -$(PYTEST) --log-cli-level debug -k "$(SINGLE_TEST)" --test_dir pp @echo "********************" Output @cat pp/*/output.txt diff --git a/kibot/out_base.py b/kibot/out_base.py index 7baab126..e851c58d 100644 --- a/kibot/out_base.py +++ b/kibot/out_base.py @@ -6,7 +6,7 @@ from .gs import GS from .kiplot import load_sch, get_board_comps_data from .misc import Rect, KICAD_VERSION_5_99, W_WRONGPASTE -if GS.kicad_version_n >= KICAD_VERSION_5_99: +if GS.kicad_version_n >= KICAD_VERSION_5_99: # pragma: no cover (Ki6) # New name, no alias ... from pcbnew import FP_SHAPE, wxPoint, LSET else: @@ -128,7 +128,7 @@ class VariantOptions(BaseOptions): @staticmethod def create_module_element(m): if GS.kicad_version_n >= KICAD_VERSION_5_99: - return FP_SHAPE(m) + return FP_SHAPE(m) # pragma: no cover (Ki6) return EDGE_MODULE(m) @staticmethod diff --git a/tests/test_plot/test_misc_2.py b/tests/test_plot/test_misc_2.py index 8b800c1c..053227c0 100644 --- a/tests/test_plot/test_misc_2.py +++ b/tests/test_plot/test_misc_2.py @@ -114,9 +114,16 @@ class NoGetTargets(BaseOutput): def test_no_get_targets(caplog): test = NoGetTargets() - test.get_targets('') - assert "Output 'Fake' (dummy) [none] doesn't implement get_targets(), plese report it" in caplog.text # Also check the dependencies fallback GS.sch = None GS.sch_file = 'fake' - assert test.get_dependencies() == [GS.sch_file] + # Start coverage + cov.load() + cov.start() + test.get_targets('') + files = test.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]