KMKfw / kmk_firmware

Clackety Keyboards Powered by Python
https://kmkfw.zulipchat.com
Other
1.32k stars 458 forks source link

board hygiene for local mocking #921

Open patricksurry opened 7 months ago

patricksurry commented 7 months ago

Adds a unittest in test_boards.py imports each of the 70+ boards/**/main.py in turn using tests/mock_board.py. This turned up a bunch of simple hygiene issues that I fixed (capitalization etc), including some doc stuff. The only one I don't know how to deal with is that several of the dactyl keyboards try to map an unknown AVR pin B7. I ignore that for now but happy to hear if anyone knows the correct fix.

The test itself is a little slow (about 5s on my old macbook) so I guess could be optional. Let me know what you think.

(background) this is so I can test an integration with https://github.com/caksoylar/keymap-drawer to draw an SVG diagram of any of the KMK layouts. Many of the boards I initially tried were broken even in a mocked setup.

xs5871 commented 6 months ago

Sounds reasonable in general, but we should make the unit tests for contributions and the firmware core independent. Suggestion: two new make targets unit-tests-boards and unit-tests-kmk (I'm open to better names), make unit-tests pull in both as a catch-all, adjust github actions to only trigger if respective sources change, and reflect all that in the docs.