summaryrefslogtreecommitdiff
path: root/gerbonara/gerber/tests/test_excellon.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2022-01-22 15:00:05 +0100
committerjaseg <git@jaseg.de>2022-01-22 15:00:05 +0100
commit7cf41c6a72e52a63b4f4d4497732a72d6623eec8 (patch)
treeb58607dd787173da641e21b678753855358495e5 /gerbonara/gerber/tests/test_excellon.py
parentb85e8b0065c1b90159970ed8139f0747e953eb3f (diff)
downloadgerbonara-7cf41c6a72e52a63b4f4d4497732a72d6623eec8.tar.gz
gerbonara-7cf41c6a72e52a63b4f4d4497732a72d6623eec8.tar.bz2
gerbonara-7cf41c6a72e52a63b4f4d4497732a72d6623eec8.zip
Fix a few more tests
Diffstat (limited to 'gerbonara/gerber/tests/test_excellon.py')
-rw-r--r--gerbonara/gerber/tests/test_excellon.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/gerbonara/gerber/tests/test_excellon.py b/gerbonara/gerber/tests/test_excellon.py
index f8d54ed..9aa5232 100644
--- a/gerbonara/gerber/tests/test_excellon.py
+++ b/gerbonara/gerber/tests/test_excellon.py
@@ -10,6 +10,7 @@ from ..cam import FileSettings
from .image_support import *
from .utils import *
+from ..utils import Inch, MM
REFERENCE_FILES = [
'easyeda/Gerber_Drill_NPTH.DRL',
@@ -34,10 +35,17 @@ REFERENCE_FILES = [
@pytest.mark.parametrize('reference', REFERENCE_FILES, indirect=True)
def test_round_trip(reference, tmpfile):
tmp = tmpfile('Output excellon', '.drl')
+ # Altium uses an excellon format specification format that gerbv doesn't understand, so we have to fix that.
+ unit_spec = ('mm', 'leading', 4) if 'altium-composite-drill' in str(reference) else None
+ # pcb-rnd does not include any unit specification at all
+ if 'pcb-rnd' in str(reference):
+ settings = FileSettings(unit=Inch, zeros='leading', number_format=(2,4))
+ else:
+ settings = None
- ExcellonFile.open(reference).save(tmp)
+ ExcellonFile.open(reference, settings=settings).save(tmp)
- mean, _max, hist = gerber_difference(reference, tmp, diff_out=tmpfile('Difference', '.png'))
+ mean, _max, hist = gerber_difference(reference, tmp, diff_out=tmpfile('Difference', '.png'), ref_unit_spec=unit_spec)
assert mean < 5e-5
assert hist[9] == 0
assert hist[3:].sum() < 5e-5*hist.size