-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respect StatusLED configuration at ShutdownLED when shutdown sequence is cancelled and the led share the same GPIO #1997
base: develop
Are you sure you want to change the base?
Conversation
6ef60c0
to
b63b715
Compare
Yeah, like this so far. |
af11c7d
to
6af1a76
Compare
Thanks for this PR! 🎉 could you check the Python unit tests, which are currently failing and try to fix them in this PR? |
Thanks for looking into it. I created this PR, because I wanted to start with fixing it, though I have no clear way on how to implement it. Doing something sometimes helps rather than thinking days about it. I plan to continue this when I find some free time. |
6af1a76
to
00a51fd
Compare
8713fe4
to
7dd5364
Compare
ba4558e
to
71d05d7
Compare
Tested in unit tests so far and I am happy with it.
|
Should the test adoptions go into a separate commit? @s-martin ? |
I think the tests never finish because of a while loop never succeeding in on the test systems. |
Yeah, that could be the issue. A method to overcome such scenarios could be mocking the methods during the tests. please have a look here for starters: https://docs.python.org/3/library/unittest.mock-examples.html |
I already mocked it by adding a mock inside that file Mocking inside the file |
50e6290
to
71d05d7
Compare
from mock import MagicMock | ||
|
||
system = MagicMock(return_value=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the test works, but the code doesn't work in production anymore I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't get the test to work when I mock in https://github.com/topas-rec/RPi-Jukebox-RFID/blob/305aa26bec34ca18b8a248d5aff7e502e9a0e7c4/components/gpio_control/test/test_gpio_control.py
* Test configuration file had still `functionCallDown` and `functionCallUp` as function calls instead of newer `functionCall1` and `functionCall2` * Made path of config file relative to the location from where the imports work (and the test is executed which is `./components/gpio_control/`
* Test didn't finished without this setting since os.system is used to check if a phoniebox service is running on the machine which may not run on machines this unit tests run on
* Code not working * Base for discussion
* untested * If a ShutdownButton and a StatusLed are both configured and use the same led pin, the status that the led should have in case a shutdown request (blinking shutdown led) is cancelled is set at the ShutdownButton
305aa26
to
54580f5
Compare
54580f5
to
e51652e
Compare
I would like to keep the led on when the shutdown sequence (holding the shutdown button for the "hold time") is cancelled and a StatusLED is configured.
It should be off when the sequence is cancelled and no StatusLED is configured.