summaryrefslogtreecommitdiff
path: root/gerbonara/tests/test_kicad_symbols.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-07-04 16:20:11 +0200
committerjaseg <git@jaseg.de>2023-07-04 16:20:11 +0200
commit8f7b2893dc9b6bc1b0c7d6f6476e98c8c27a948c (patch)
treec9927e1f36c363a63e6479218b5dc5d7cd2d3156 /gerbonara/tests/test_kicad_symbols.py
parente696c09eac8f997fc82bbe281e9b6c76dc02308a (diff)
downloadgerbonara-8f7b2893dc9b6bc1b0c7d6f6476e98c8c27a948c.tar.gz
gerbonara-8f7b2893dc9b6bc1b0c7d6f6476e98c8c27a948c.tar.bz2
gerbonara-8f7b2893dc9b6bc1b0c7d6f6476e98c8c27a948c.zip
Fix failing symbol tests
Diffstat (limited to 'gerbonara/tests/test_kicad_symbols.py')
-rw-r--r--gerbonara/tests/test_kicad_symbols.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/gerbonara/tests/test_kicad_symbols.py b/gerbonara/tests/test_kicad_symbols.py
index 0a6c595..f7ed148 100644
--- a/gerbonara/tests/test_kicad_symbols.py
+++ b/gerbonara/tests/test_kicad_symbols.py
@@ -6,12 +6,14 @@ from ..cad.kicad.sexp import build_sexp
from ..cad.kicad.sexp_mapper import sexp
from ..cad.kicad.symbols import Library
+from .utils import tmpfile
+
def test_parse(kicad_library_file):
Library.open(kicad_library_file)
-def test_round_trip(kicad_library_file):
+def test_round_trip(kicad_library_file, tmpfile):
print('========== Stage 1 load ==========')
orig_lib = Library.open(kicad_library_file)
print('========== Stage 1 save ==========')
@@ -31,7 +33,11 @@ def test_round_trip(kicad_library_file):
original = re.sub(r'\) \)', '))', original)
original = re.sub(r'\) \)', '))', original)
original = re.sub(r'\) \)', '))', original)
+ tmpfile('Processed original', '.kicad_sym').write_text(original)
+
stage1 = re.sub(r'\(', '\n(', re.sub(r'\s+', ' ', stage1_sexp))
+ tmpfile('Processed stage 1 output', '.kicad_sym').write_text(stage1)
+
for original, stage1 in zip_longest(original.splitlines(), stage1.splitlines()):
if original.startswith('(version'):
continue
@@ -54,6 +60,10 @@ def test_round_trip(kicad_library_file):
# There is some disagreement as to whether rotation angles are ints or floats, and the spec doesn't say.
return
+ if 'hide' in original or 'hide' in stage1:
+ # KiCad changed the position of the hide token inside text effects between versions.
+ return
+
assert original == stage1