import pytest import sys import os.path from ee.kicad import read_schematic from ee import kicad import ee print("type=" + str(type(kicad))) for x in dir(ee): print("x={}".format(x)) basedir = os.path.dirname(os.path.abspath(__file__)) def dump_schema(sch): print("Libraries") for l in sch.libraries: print("name: {}".format(l.name)) print("Components") for c in sch.components: if c.unit != 1: continue print("REF: {}, fields={}".format(c.ref if c.unit == 1 else "{}/{}".format(c.ref, c.unit), len(c.fields))) for f in c.fields: print(" {}={}".format(f.name, f.value)) def load(path): p = basedir + "/parser/" + path print("p={}".format(p)) return read_schematic(p) def test_demo_1(): sch = load("parser-demo-1.sch") dump_schema(sch) r101 = sch.get_component("R101") assert r101 def test_sch(): sch = load("foo.sch") dump_schema(sch)