From 130f7b25a30f420dd9e7556feade3ef65fa76872 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Wed, 1 Dec 2021 15:55:38 -0300 Subject: [PATCH] Fixed tests that now needs to initialize global defaults. --- tests/test_plot/test_misc_2.py | 9 ++++++++- tests/test_plot/test_print_sch.py | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/test_plot/test_misc_2.py b/tests/test_plot/test_misc_2.py index fdcd9e33..77ac64a7 100644 --- a/tests/test_plot/test_misc_2.py +++ b/tests/test_plot/test_misc_2.py @@ -26,7 +26,7 @@ from kibot.bom.columnlist import ColumnList from kibot.bom.units import get_prefix from kibot.__main__ import detect_kicad from kibot.kicad.config import KiConf - +from kibot.globals import Globals cov = coverage.Coverage() mocked_check_output_FNF = True @@ -63,10 +63,17 @@ def patch_functions(m): m.setattr('kibot.kiplot.exec_with_retry', mocked_call) +def init_globals(): + glb = Globals() + glb.set_tree({}) + glb.config(None) + + def run_compress(ctx, test_import_fail=False): with context.cover_it(cov): # Load the plug-ins load_actions() + init_globals() # Create a compress object with the dummy file as source out = RegOutput.get_class_for('compress')() out.set_tree({'options': {'format': 'RAR', 'files': [{'source': ctx.get_out_path('*')}]}}) diff --git a/tests/test_plot/test_print_sch.py b/tests/test_plot/test_print_sch.py index 2f840182..b1155953 100644 --- a/tests/test_plot/test_print_sch.py +++ b/tests/test_plot/test_print_sch.py @@ -19,6 +19,7 @@ if prev_dir not in sys.path: sys.path.insert(0, prev_dir) from kibot.misc import (PDF_SCH_PRINT, SVG_SCH_PRINT) from kibot.kicad.v5_sch import Schematic, SchFileError, DrawPoligon, Pin +from kibot.globals import Globals # Utils import from utils import context @@ -65,6 +66,9 @@ def check_l1(ctx): ctx.run() o_name = os.path.join(NI_DIR, 'test_v5.sch') ctx.expect_out_file(o_name) + glb = Globals() + glb.set_tree({}) + glb.config(None) sch = Schematic() try: sch.load(ctx.get_out_path(o_name), 'no_project')