From 2c9386bf9f1d465907903e7da79663b5b7e30ace Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 16 Jul 2018 11:36:29 +0200 Subject: wip --- test/doit/schematics/schematic-1.sch | 77 ++++++++++++++++++++++++++++++++++++ test/doit/test_doit.py | 35 ++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 test/doit/schematics/schematic-1.sch create mode 100644 test/doit/test_doit.py (limited to 'test') diff --git a/test/doit/schematics/schematic-1.sch b/test/doit/schematics/schematic-1.sch new file mode 100644 index 0000000..a805e83 --- /dev/null +++ b/test/doit/schematics/schematic-1.sch @@ -0,0 +1,77 @@ +EESchema Schematic File Version 4 +EELAYER 26 0 +EELAYER END +$Descr A4 11693 8268 +encoding utf-8 +Sheet 1 1 +Title "" +Date "" +Rev "" +Comp "" +Comment1 "" +Comment2 "" +Comment3 "" +Comment4 "" +$EndDescr +$Comp +L Device:R R? +U 1 1 5B431328 +P 4400 2600 +F 0 "R?" V 4193 2600 50 0000 C CNN +F 1 "10k" V 4284 2600 50 0000 C CNN +F 2 "" V 4330 2600 50 0001 C CNN +F 3 "~" H 4400 2600 50 0001 C CNN + 1 4400 2600 + 0 1 1 0 +$EndComp +$Comp +L Device:Battery_Cell BT? +U 1 1 5B431438 +P 3700 2900 +F 0 "BT?" H 3818 2996 50 0000 L CNN +F 1 "9V" H 3818 2905 50 0000 L CNN +F 2 "" V 3700 2960 50 0001 C CNN +F 3 "~" V 3700 2960 50 0001 C CNN + 1 3700 2900 + 1 0 0 -1 +$EndComp +$Comp +L Device:C C? +U 1 1 5B4314AB +P 5000 2850 +F 0 "C?" H 5115 2896 50 0000 L CNN +F 1 "1u" H 5115 2805 50 0000 L CNN +F 2 "" H 5038 2700 50 0001 C CNN +F 3 "~" H 5000 2850 50 0001 C CNN + 1 5000 2850 + 1 0 0 -1 +$EndComp +Wire Wire Line + 3700 3000 3700 3100 +Wire Wire Line + 5000 3100 5000 3000 +$Comp +L power:GND #PWR? +U 1 1 5B4315FE +P 3700 3200 +F 0 "#PWR?" H 3700 2950 50 0001 C CNN +F 1 "GND" H 3705 3027 50 0000 C CNN +F 2 "" H 3700 3200 50 0001 C CNN +F 3 "" H 3700 3200 50 0001 C CNN + 1 3700 3200 + 1 0 0 -1 +$EndComp +Wire Wire Line + 3700 3200 3700 3100 +Connection ~ 3700 3100 +Wire Wire Line + 3700 2700 3700 2600 +Wire Wire Line + 5000 2600 5000 2700 +Wire Wire Line + 3700 2600 4250 2600 +Wire Wire Line + 3700 3100 5000 3100 +Wire Wire Line + 4550 2600 5000 2600 +$EndSCHEMATC diff --git a/test/doit/test_doit.py b/test/doit/test_doit.py new file mode 100644 index 0000000..61c5074 --- /dev/null +++ b/test/doit/test_doit.py @@ -0,0 +1,35 @@ +import pytest +import os.path +import os + +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): + from ee.kicad.doit import KicadDoitTasks + + args = dict( + sch=os.path.join(schematics_dir, "schematic-1.sch"), + sch_object_set_dir=os.path.join(tmpdir, "kicad-sch") + ) + tasks = list(KicadDoitTasks(**args).tasks()) + assert(len(tasks) == 1) + create_kicad_sch_objects = find_task(tasks, "create-kicad-sch-objects") + exec_task(create_kicad_sch_objects) + +# thirdparty/olinuxino/HARDWARE/A64-OLinuXino/A64-OLinuXino_Rev_C/A64-OlinuXino_Rev_C.sch -- cgit v1.2.3