ZeroPhone / ZPUI

Official ZeroPhone UI framework, based on pyLCI
http://zpui.rtfd.org/
Apache License 2.0
78 stars 19 forks source link

Cannot properly mock `luma.emulator.device` and `RPi.GPIO` imports in tests, need help #135

Open CRImier opened 5 years ago

CRImier commented 5 years ago

I'm trying to cover some input drivers in the tests/test_drivers.py file, and I ran into a problem - I don't yet understand how to mock multi-level imports (like import luma.emulator.device). So, some input drivers (emulator, pi_gpio and pi_gpio_matrix) are currently not covered by tests because luma.emulator.device and RPi.GPIO can't be mocked. I can't yet figure it out, I've left some attempts in the tests/test_drivers.py file (linked above), but the tests are skipped for now. If someone could help figure this out, it would be great.