tests: Remove extra spaces

This commit is contained in:
Bastien Nocera 2021-08-23 13:18:13 +02:00
parent 6701c99680
commit c48108763b

View file

@ -239,17 +239,17 @@ class Tests(dbusmock.DBusTestCase):
def create_empty_platform_profile(self):
acpi_dir = os.path.join(self.testbed.get_root_dir(), "sys/firmware/acpi/")
os.makedirs(acpi_dir)
with open(os.path.join(acpi_dir, "platform_profile") ,'w') as profile:
with open(os.path.join(acpi_dir, "platform_profile"),'w') as profile:
profile.write('\n')
with open(os.path.join(acpi_dir, "platform_profile_choices") ,'w') as choices:
with open(os.path.join(acpi_dir, "platform_profile_choices"),'w') as choices:
choices.write('\n')
def create_platform_profile(self):
acpi_dir = os.path.join(self.testbed.get_root_dir(), "sys/firmware/acpi/")
os.makedirs(acpi_dir)
with open(os.path.join(acpi_dir, "platform_profile") ,'w') as profile:
with open(os.path.join(acpi_dir, "platform_profile"),'w') as profile:
profile.write("performance\n")
with open(os.path.join(acpi_dir, "platform_profile_choices") ,'w') as choices:
with open(os.path.join(acpi_dir, "platform_profile_choices"),'w') as choices:
choices.write("low-power balanced performance\n")
def remove_platform_profile(self):
@ -349,17 +349,17 @@ class Tests(dbusmock.DBusTestCase):
# Create 2 CPUs with preferences
dir1 = os.path.join(self.testbed.get_root_dir(), "sys/devices/system/cpu/cpufreq/policy0/")
os.makedirs(dir1)
with open(os.path.join(dir1, "energy_performance_preference") ,'w') as prefs:
with open(os.path.join(dir1, "energy_performance_preference"),'w') as prefs:
prefs.write("performance\n")
dir2 = os.path.join(self.testbed.get_root_dir(), "sys/devices/system/cpu/cpufreq/policy1/")
os.makedirs(dir2)
with open(os.path.join(dir2, "energy_performance_preference") ,'w') as prefs:
with open(os.path.join(dir2, "energy_performance_preference"),'w') as prefs:
prefs.write("performance\n")
# Create no_turbo pref
pstate_dir = os.path.join(self.testbed.get_root_dir(), "sys/devices/system/cpu/intel_pstate")
os.makedirs(pstate_dir)
with open(os.path.join(pstate_dir, "no_turbo") ,'w') as no_turbo:
with open(os.path.join(pstate_dir, "no_turbo"),'w') as no_turbo:
no_turbo.write("0\n")
self.start_daemon()
@ -384,7 +384,7 @@ class Tests(dbusmock.DBusTestCase):
self.assertEqual(contents, b'performance')
# Disable turbo
with open(os.path.join(pstate_dir, "no_turbo") ,'w') as no_turbo:
with open(os.path.join(pstate_dir, "no_turbo"),'w') as no_turbo:
no_turbo.write("1\n")
self.assertEventually(lambda: self.have_text_in_log('File monitor change happened for '))
@ -407,7 +407,7 @@ class Tests(dbusmock.DBusTestCase):
# Create CPU with preference
dir1 = os.path.join(self.testbed.get_root_dir(), "sys/devices/system/cpu/cpufreq/policy0/")
os.makedirs(dir1)
with open(os.path.join(dir1, "energy_performance_preference") ,'w') as prefs:
with open(os.path.join(dir1, "energy_performance_preference"),'w') as prefs:
prefs.write("performance\n")
upowerd, obj_upower = self.spawn_server_template(
@ -521,9 +521,9 @@ class Tests(dbusmock.DBusTestCase):
self.assertEqual(len(profiles), 2)
acpi_dir = os.path.join(self.testbed.get_root_dir(), "sys/firmware/acpi/")
with open(os.path.join(acpi_dir, "platform_profile_choices") ,'w') as choices:
with open(os.path.join(acpi_dir, "platform_profile_choices"),'w') as choices:
choices.write("low-power\nbalanced\nperformance\n")
with open(os.path.join(acpi_dir, "platform_profile") ,'w') as profile:
with open(os.path.join(acpi_dir, "platform_profile"),'w') as profile:
profile.write("performance\n")
# Wait for profiles to get reloaded
@ -541,9 +541,9 @@ class Tests(dbusmock.DBusTestCase):
# Uses cool instead of low-power
acpi_dir = os.path.join(self.testbed.get_root_dir(), "sys/firmware/acpi/")
os.makedirs(acpi_dir)
with open(os.path.join(acpi_dir, "platform_profile") ,'w') as profile:
with open(os.path.join(acpi_dir, "platform_profile"),'w') as profile:
profile.write("cool\n")
with open(os.path.join(acpi_dir, "platform_profile_choices") ,'w') as choices:
with open(os.path.join(acpi_dir, "platform_profile_choices"),'w') as choices:
choices.write("cool balanced performance\n")
self.start_daemon()
@ -563,9 +563,9 @@ class Tests(dbusmock.DBusTestCase):
# Uses cool instead of low-power
acpi_dir = os.path.join(self.testbed.get_root_dir(), "sys/firmware/acpi/")
os.makedirs(acpi_dir)
with open(os.path.join(acpi_dir, "platform_profile") ,'w') as profile:
with open(os.path.join(acpi_dir, "platform_profile"),'w') as profile:
profile.write("cool\n")
with open(os.path.join(acpi_dir, "platform_profile_choices") ,'w') as choices:
with open(os.path.join(acpi_dir, "platform_profile_choices"),'w') as choices:
choices.write("quiet balanced balanced-performance performance\n")
self.start_daemon()
@ -740,9 +740,9 @@ class Tests(dbusmock.DBusTestCase):
self.assertEqual(self.get_dbus_property('ActiveProfile'), 'balanced')
acpi_dir = os.path.join(self.testbed.get_root_dir(), "sys/firmware/acpi/")
with open(os.path.join(acpi_dir, "platform_profile_choices") ,'w') as choices:
with open(os.path.join(acpi_dir, "platform_profile_choices"),'w') as choices:
choices.write("low-power\nbalanced\nperformance\n")
with open(os.path.join(acpi_dir, "platform_profile") ,'w') as profile:
with open(os.path.join(acpi_dir, "platform_profile"),'w') as profile:
profile.write("performance\n")
self.assertEventually(lambda: self.get_dbus_property('ActiveProfile') == 'power-saver')