diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/doit/test_doit.py | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/test/doit/test_doit.py b/test/doit/test_doit.py index 3a0c7ec..4076af8 100644 --- a/test/doit/test_doit.py +++ b/test/doit/test_doit.py @@ -4,16 +4,13 @@ import os import os.path from inspect import Parameter -logger = logging.getLogger(__name__) - -filedir = os.path.dirname(os.path.abspath(__file__)) -schematics_dir = os.path.join(filedir, "schematics") +import ee.kicad.doit +from ee.kicad.doit import task_kicad_sch_to_data_set, task_kicad_pcb_to_data_set, task_kicad_create_component_data_set +logger = logging.getLogger(__name__) -def find_task(tasks, name: str): - t = next((t for t in tasks if t["name"] == name), None) - assert t is not None, "Could not find task named {}".format(name) - return t +file_dir = os.path.dirname(os.path.abspath(__file__)) +schematics_dir = os.path.join(file_dir, "schematics") def exec_task(task): @@ -32,18 +29,12 @@ def exec_task(task): a(**parameters) +# noinspection SpellCheckingInspection def test_doit(tmpdir, caplog): - from ee.kicad.doit import KicadDoitTasks - - args = dict( - sch=os.path.join(schematics_dir, "schematic-1.sch"), - kicad_pcb=os.path.join(schematics_dir, "schematic-1.kicad_pcb"), - data_set_dir=os.path.join(tmpdir, "ee"), - ) - tasks = list(KicadDoitTasks(**args).tasks()) - assert (len(tasks) > 1) - exec_task(find_task(tasks, "kicad-sch-to-data-set")) - exec_task(find_task(tasks, "kicad-pcb-to-data-set")) - exec_task(find_task(tasks, "kicad-create-component-data-set")) - -# thirdparty/olinuxino/HARDWARE/A64-OLinuXino/A64-OLinuXino_Rev_C/A64-OlinuXino_Rev_C.sch + ee.kicad.doit.init(sch=os.path.join(schematics_dir, "schematic-1.sch"), + kicad_pcb=os.path.join(schematics_dir, "schematic-1.kicad_pcb"), + data_set_dir=os.path.join(tmpdir, "ee"), ) + + exec_task(task_kicad_sch_to_data_set()) + exec_task(task_kicad_pcb_to_data_set()) + exec_task(task_kicad_create_component_data_set()) |