hadleyrich / GerbLook

A web based gerber renderer based on Python, gerbv and imagemagick held together with a little glue and string.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Would be good to have some unittests

mithro opened this issue · comments

The guess_layer function in gerber.py is pretty complicated, it would be nice to have some tests which check additions don't break existing use cases.

(Adding this because I'm about to send a pull request which includes tests :)

Maybe we could make that available as JSON and use the exact same data?

Hi guys. Thanks for the contribution @mithro that's great. Excellent idea @kasbah that was my first thought too - it would be a great idea to make it JSON and load it up. No point duplicating effort.

For providing the whats-that-gerber test cases as JSON, we have a couple options:

  1. Convert the existing filenames-by-cad.js to a JSON file and leave it where it is
  2. Spin out the test case JSON file into its own node module hosted on npm and wherever else (GitHub releases would be easy)

What would be the easiest way for you guys to get and consume this JSON file?

Either way works fine, we can just grab it directly over HTTP from where ever it is. If it stays where is is it might be a good idea to add a note that it's used externally so that fact doesn't get forgotten sometime in the future.

I would suggest you use a URL pointing to a specific version, either through npmcdn or Github (or both?)

https://npmcdn.com/whats-that-gerber@2.0.3/test/filenames-by-cad.js
https://raw.githubusercontent.com/tracespace/whats-that-gerber/v2.0.3/test/filenames-by-cad.js

With the npmcdn one you can also put in @^2.0.3 which will grab newer minor or patch versions (i.e. 2.x.x but not 3.x.x) or @~2.0.3 which will get newer patch versions (i.e. 2.0.x). I believe whats-that-gerber follows semantic versioning so moving the JSON file should only happen with a major version bump then.

Whats-that-gerber 2.1.0 has been released with the test cases as JSON. I would suggest you use this source: https://npmcdn.com/whats-that-gerber@^2.1.0/test/filenames-by-cad.json