Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/jakeogh/skidl into d…
Browse files Browse the repository at this point in the history
…evdev
  • Loading branch information
devbisme committed Apr 28, 2024
2 parents 4a0ef22 + ebd73b3 commit 064c108
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/skidl/tools/kicad8/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ def load_sch_lib(lib, filename=None, lib_search_paths_=None, lib_section=None):
lib_section: Only used for SPICE simulations.
"""

from skidl import Part, KICAD7
from skidl import Part, KICAD8
from skidl.tools import lib_suffixes

# Try to open the file using allowable suffixes for the versions of KiCAD.
suffixes = lib_suffixes[KICAD7]
suffixes = lib_suffixes[KICAD8]
base, suffix = os.path.splitext(filename)
if suffix:
# If an explicit file extension was given, use it instead of tool lib default extensions.
Expand Down Expand Up @@ -179,7 +179,7 @@ def load_sch_lib(lib, filename=None, lib_search_paths_=None, lib_section=None):
lib.add_parts(
Part(
part_defn=part_defn, # A list of lists that define the part.
tool=KICAD7,
tool=KICAD8,
dest=LIBRARY,
filename=filename,
name=part_name,
Expand Down Expand Up @@ -332,7 +332,7 @@ def parse_pins(symbol, unit_id):

# Return true if the symbol had pins.
return bool(symbol_pins)

def parse_draw_cmds(symbol):
'''Return a list of graphic drawing commands contained in the symbol.'''
return [
Expand All @@ -341,7 +341,7 @@ def parse_draw_cmds(symbol):
if item[0].value().lower()
in ("arc", "bezier", "circle", "pin", "polyline", "rectangle", "text")
]

# Parse top-level pins. (Pins in any units are parsed later.)
parse_pins(part.part_defn, unit_id="main")

Expand Down
8 changes: 7 additions & 1 deletion tests/unit_tests/test_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pytest

from skidl import search, set_default_tool, KICAD, KICAD6, KICAD7
from skidl import search, set_default_tool, KICAD, KICAD6, KICAD7, KICAD8

from .setup_teardown import setup_function, teardown_function

Expand All @@ -26,3 +26,9 @@ def test_search_3(capfd):
search("ESP32") # Should find 6 matches in RF_Module.kicad_sym.
out, err = capfd.readouterr()
assert out.count("RF_Module.kicad_sym:") == 6

def test_search_4(capfd):
set_default_tool(KICAD8)
search("ESP32") # Should find 6 matches in RF_Module.kicad_sym.
out, err = capfd.readouterr()
assert out.count("RF_Module.kicad_sym:") == 6
5 changes: 3 additions & 2 deletions tests/unit_tests/test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
KICAD,
KICAD6,
KICAD7,
KICAD8,
SKIDL,
TEMPLATE,
Part,
Expand All @@ -31,7 +32,7 @@
def test_missing_lib():
# Sometimes, loading a part from a non-existent library doesn't throw an
# exception until the second time it's tried. This detects that error.

# Don't allow searching backup lib that might exist from previous tests.
SchLib.reset()
skidl.config.query_backup_lib=False
Expand Down Expand Up @@ -285,4 +286,4 @@ def test_lib_kicad6_repository():
lib_4xxx = SchLib(lib_name, tool=KICAD6)
print("# of parts in {} = {}".format(lib_name, len(lib_4xxx.parts)))
for part in lib_4xxx.parts:
check_lib_part(part)
check_lib_part(part)

0 comments on commit 064c108

Please sign in to comment.