import logging import os import os.path import pytest import logging filedir = os.path.dirname(os.path.abspath(__file__)) schematics_dir = os.path.join(filedir, "schematics") def find_task(tasks, name: str): t = next((t for t in tasks if t["name"] == name), None) assert(t is not None) return t def exec_task(task): targets = task["targets"] for a in task["actions"]: if isinstance(a, str): cmd = a % dict(targets=" ".join(targets)) ret = os.system(cmd) assert(ret == 0) else: a() def test_doit(tmpdir, caplog): from ee.kicad.doit import KicadDoitTasks args = dict( sch=os.path.join(schematics_dir, "schematic-1.sch"), 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-create-component-data-set")) # thirdparty/olinuxino/HARDWARE/A64-OLinuXino/A64-OLinuXino_Rev_C/A64-OlinuXino_Rev_C.sch