gio/tests/power-profile-monitor*.py: Use upower ppd daemon APIs

This commit is contained in:
Marco Trevisan (Treviño) 2025-02-07 00:47:34 +01:00
parent 71d08b707a
commit dba2d618d5
2 changed files with 9 additions and 9 deletions

View File

@ -49,12 +49,12 @@ try:
) # FIXME version ) # FIXME version
try: try:
(self.p_mock, self.obj_ppd) = self.spawn_server_template( (self.p_mock, self.obj_ppd) = self.spawn_server_template(
"power_profiles_daemon", {}, stdout=subprocess.PIPE "upower_power_profiles_daemon", {}, stdout=subprocess.PIPE
) )
except ModuleNotFoundError: except ModuleNotFoundError:
raise unittest.SkipTest( raise unittest.SkipTest(
"power-profiles-daemon dbusmock template not " "power-profiles-daemon dbusmock template not "
"found. Requires dbusmock > 0.23.1." "found. Requires dbusmock > 0.31.1."
) # FIXME version ) # FIXME version
# set log to nonblocking # set log to nonblocking
flags = fcntl.fcntl(self.p_mock.stdout, fcntl.F_GETFL) flags = fcntl.fcntl(self.p_mock.stdout, fcntl.F_GETFL)
@ -108,7 +108,7 @@ try:
self.power_profile_monitor.get_power_saver_enabled(), False self.power_profile_monitor.get_power_saver_enabled(), False
) )
self.dbus_props.Set( self.dbus_props.Set(
"net.hadess.PowerProfiles", "org.freedesktop.UPower.PowerProfiles",
"ActiveProfile", "ActiveProfile",
dbus.String("power-saver", variant_level=1), dbus.String("power-saver", variant_level=1),
) )
@ -119,7 +119,7 @@ try:
) )
self.dbus_props.Set( self.dbus_props.Set(
"net.hadess.PowerProfiles", "org.freedesktop.UPower.PowerProfiles",
"ActiveProfile", "ActiveProfile",
dbus.String("balanced", variant_level=1), dbus.String("balanced", variant_level=1),
) )

View File

@ -55,12 +55,12 @@ try:
) )
try: try:
(self.p_mock, self.obj_ppd) = self.spawn_server_template( (self.p_mock, self.obj_ppd) = self.spawn_server_template(
"power_profiles_daemon", {}, stdout=subprocess.PIPE "upower_power_profiles_daemon", {}, stdout=subprocess.PIPE
) )
except ModuleNotFoundError: except ModuleNotFoundError:
raise unittest.SkipTest( raise unittest.SkipTest(
"power-profiles-daemon dbusmock template not " "power-profiles-daemon dbusmock template not "
"found. Requires dbusmock > 0.23.1." "found. Requires dbusmock > 0.31.1."
) )
# set log to nonblocking # set log to nonblocking
flags = fcntl.fcntl(self.p_mock.stdout, fcntl.F_GETFL) flags = fcntl.fcntl(self.p_mock.stdout, fcntl.F_GETFL)
@ -132,7 +132,7 @@ try:
self.power_profile_monitor.get_power_saver_enabled(), False self.power_profile_monitor.get_power_saver_enabled(), False
) )
self.dbus_props.Set( self.dbus_props.Set(
"net.hadess.PowerProfiles", "org.freedesktop.UPower.PowerProfiles",
"ActiveProfile", "ActiveProfile",
dbus.String("power-saver", variant_level=1), dbus.String("power-saver", variant_level=1),
) )
@ -143,7 +143,7 @@ try:
) )
self.dbus_props.Set( self.dbus_props.Set(
"net.hadess.PowerProfiles", "org.freedesktop.UPower.PowerProfiles",
"ActiveProfile", "ActiveProfile",
dbus.String("balanced", variant_level=1), dbus.String("balanced", variant_level=1),
) )
@ -157,7 +157,7 @@ try:
"""power-saver-enabled property default value""" """power-saver-enabled property default value"""
self.dbus_props.Set( self.dbus_props.Set(
"net.hadess.PowerProfiles", "org.freedesktop.UPower.PowerProfiles",
"ActiveProfile", "ActiveProfile",
dbus.String("power-saver", variant_level=1), dbus.String("power-saver", variant_level=1),
) )