diff options
author | Bastien Nocera <hadess@hadess.net> | 2023-04-15 12:16:19 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2023-04-15 12:16:19 +0200 |
commit | 5db1bce65fcd509a7624dc2843173921b79e7d7b (patch) | |
tree | a3e959b110c653b27816cf344d3478868a7e1538 | |
parent | b3c439ab4aa086f4e42cc9b5f3d73e48c0346641 (diff) | |
download | upower-5db1bce65fcd509a7624dc2843173921b79e7d7b.tar.gz |
tests: Fix discharge rates in test_battery_state_guessing
up_device_battery_estimate_power() expects a charge/discharge rate of
0.5W to be significant, but the existing code yielded a rate of
-0.000240W.
Fix the units so that the amount of change in energy_now is at least
1W/s converted to µWh.
-rwxr-xr-x | src/linux/integration-test.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/linux/integration-test.py b/src/linux/integration-test.py index 42bf736..790d8c2 100755 --- a/src/linux/integration-test.py +++ b/src/linux/integration-test.py @@ -615,7 +615,8 @@ class Tests(dbusmock.DBusTestCase): # Discharge for 20s: for i in range(25): time.sleep(1) - energy_now -= 10.0 / 3600 + # 1W usage over 1 second + energy_now -= 1.0 * 1000000 / 3600 self.testbed.set_attribute(bat0, 'energy_now', str(int(energy_now))) self.assertDevs({ 'battery_BAT0': { 'State' : UP_DEVICE_STATE_DISCHARGING }, 'line_power_AC' : {} }) @@ -630,7 +631,8 @@ class Tests(dbusmock.DBusTestCase): # Charge for a while for i in range(25): time.sleep(1) - energy_now += 10.0 / 3600 + # 1W charge over 1 second + energy_now += 1.0 * 1000000 / 3600 self.testbed.set_attribute(bat0, 'energy_now', str(int(energy_now))) self.assertDevs({ 'battery_BAT0': { 'State' : UP_DEVICE_STATE_CHARGING }, 'line_power_AC' : {} }) |