aboutsummaryrefslogtreecommitdiff
path: root/test/doit
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-07-16 11:36:29 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2018-07-16 11:36:29 +0200
commit2c9386bf9f1d465907903e7da79663b5b7e30ace (patch)
treee98984548dd80758e8ffb69cbe9e20f83f6229d7 /test/doit
parent6f34648cf13a8710c767d553e3313985f5d3fa28 (diff)
downloadee-python-2c9386bf9f1d465907903e7da79663b5b7e30ace.tar.gz
ee-python-2c9386bf9f1d465907903e7da79663b5b7e30ace.tar.bz2
ee-python-2c9386bf9f1d465907903e7da79663b5b7e30ace.tar.xz
ee-python-2c9386bf9f1d465907903e7da79663b5b7e30ace.zip
wip
Diffstat (limited to 'test/doit')
-rw-r--r--test/doit/schematics/schematic-1.sch77
-rw-r--r--test/doit/test_doit.py35
2 files changed, 112 insertions, 0 deletions
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