Update linux/battery module to support both BAT0 and BAT1 #838
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update linux/battery module to support both BAT0 and BAT1
Description
This PR added support for BAT1 in the linux battery module. For some linux dirstros, such as Arch Linux (which I run) the battery for certain laptop can be BAT1, instead of BAT0 which
plyer
already supported.This PR will make
plyer
battery module work for every linux distribution. Fixing the error I asked to reopen and now Closes #743.Related Issue(s)
There might be other issues closed, like this past one but not resolved.
Changes
plyer/tests/test_battery.py
, which was runningassert_called_once_with()
and added testing for both BAT0 and BAT1. N.B.: I didn't understand why had to make sure it was called once, please refactor or lemme know.How Has This Been Tested?
pytest
and confirmed they passed, butTestUniqueID.test_uniqueid
which was failing beforehand.Screenshots
Checklist
Additional Notes
The only concern is that I had to change the previous test as it required for the battery to only be called once (I don't understand why), the command is one call already.
However, if there is a reason behind it, this my port breaking changes. Please @KeyWeeUsr, let me know if the check for one call is mandatory.