rpi-gpio.js
rpi-gpio.js copied to clipboard
Hardware checks
This pull requests adds some basic hardware and platform checks. First check is wether or not to require epoll, and the second check is wether or not the system is running on a raspberry pi.
The reason I added these checks is to improve development experience. With these checks in place, the module doesn't break the application it is being used in if the development environment isn't a raspberry pi.
Some tests are failing and I would appreciate it if you could try get them passing again. I haven't had enough time to do that yet.
Cheers
Hi, thanks for the patch and I'm happy to help with the tests, but just to warn you it may be a few months before I can spare the time unfortunately, and I have no access to my Raspberry Pis at present. I'm hoping I can at least have a go at the tests before then. Cheers.
I'll give a go at the tests sometime tomorrow and see if I can get them passing.
As you can see in the log, the test's are not passing because the Travis CI environment obviously isn't a raspberry pi.
Maybe a easy fix would be to add a option to force requiring epoll and such, even if not on a raspberry pi. Then in the test that option could be used.
At the moment the tests are written to stub/mock out their dependencies. I want to stick to this approach because it means we can test all of the module code, and assert on how it interacts with those dependencies. I don't want to get into a situation where flags are used to make the module execute a separate code path when it is under test.
The tests do pass on Travis on the master branch so there is no inherent problem with this approach.
I can't remember exactly where we are with this PR but I'm not sure that it's needed now. The tests do run in a non-RPI environment because Epoll does get stubbed out correctly. I do all my dev on non-RPI hardware using the test suite. If anyone is having problems then raise another issue and let's discuss the options
Generally test do past with your approach, but this PR (which is in my opinion very important) add a hardware check. That check obviously detects the travis environment. Thus only that initial check needs to be removed for the tests.