summaryrefslogtreecommitdiff
diff options
-rwxr-xr-xbin/alsa_pcm_info.py2
-rwxr-xr-xbin/disk_stats_test.sh2
-rwxr-xr-xbin/i2c_driver_test.py6
-rwxr-xr-xbin/light_sensor_test.sh2
-rwxr-xr-xbin/pm_test.py20
-rwxr-xr-xbin/removable_storage_test.py10
-rw-r--r--units/monitor/jobs.pxu2
-rw-r--r--units/power-management/jobs.pxu4
8 files changed, 26 insertions, 22 deletions
diff --git a/bin/alsa_pcm_info.py b/bin/alsa_pcm_info.py
index abb870f..fe3a744 100755
--- a/bin/alsa_pcm_info.py
+++ b/bin/alsa_pcm_info.py
@@ -17,7 +17,7 @@ PCM_FILE = '/proc/asound/pcm'
if os.path.exists(PCM_FILE):
with open(PCM_FILE, 'r') as f:
for line in f:
- t = [l.strip() for l in line.split(':')]
+ t = [device_line.strip() for device_line in line.split(':')]
# 0 = Card and device id
ids = t[0].split('-')
print("Card: {}".format(ids[0]))
diff --git a/bin/disk_stats_test.sh b/bin/disk_stats_test.sh
index 41ef626..a56934a 100755
--- a/bin/disk_stats_test.sh
+++ b/bin/disk_stats_test.sh
@@ -27,7 +27,7 @@ if [[ "$1" != '' ]]; then
fi
nvdimm="pmem"
-if [ -z "${DISK##*$nvdimm*}" ];then
+if [ -z "${DISK##*"$nvdimm"*}" ];then
echo "Disk $DISK appears to be an NVDIMM, skipping"
exit "$STATUS"
fi
diff --git a/bin/i2c_driver_test.py b/bin/i2c_driver_test.py
index c6aae78..a5c11f2 100755
--- a/bin/i2c_driver_test.py
+++ b/bin/i2c_driver_test.py
@@ -68,9 +68,9 @@ class Device():
result = subprocess.check_output(['i2cdetect', '-y', '-r', str(i)],
universal_newlines=True)
print(result)
- result_line = result.splitlines()[1:]
- for l in result_line:
- address_value = l.strip('\n').split(':')[1].split()
+ result_lines = result.splitlines()[1:]
+ for r in result_lines:
+ address_value = r.strip('\n').split(':')[1].split()
for v in address_value:
if v != '--':
exit_code = 0
diff --git a/bin/light_sensor_test.sh b/bin/light_sensor_test.sh
index 494ca39..1348357 100755
--- a/bin/light_sensor_test.sh
+++ b/bin/light_sensor_test.sh
@@ -40,7 +40,7 @@ fi
#Print 5 values of the Light sensor value form log file
for i in {1..5}
do
- echo "Ambient light sensor value " $i: "$(grep 'Light' "$PLAINBOX_SESSION_SHARE"/light_sensor_test.log | awk '{print $3}' | sed -n "$i"p)"
+ echo "Ambient light sensor value $i: " "$(grep 'Light' "$PLAINBOX_SESSION_SHARE"/light_sensor_test.log | awk '{print $3}' | sed -n "$i"p)"
done
exit 0
diff --git a/bin/pm_test.py b/bin/pm_test.py
index 92a5863..e6edb88 100755
--- a/bin/pm_test.py
+++ b/bin/pm_test.py
@@ -257,10 +257,10 @@ class PowerManagementOperation():
problems = ''
fwts_log_path = os.path.join(self.args.log_dir, 'fwts.log')
try:
- with open(fwts_log_path, 'rt') as f:
+ with open(fwts_log_path, 'rt') as fwts_log:
magic_line_s3 = 'Completed S3 cycle(s) \n'
magic_line_s2idle = 'Completed s2idle cycle(s) \n'
- lines = f.readlines()
+ lines = fwts_log.readlines()
count_s3 = lines.count(magic_line_s3)
count_s2idle = lines.count(magic_line_s2idle)
count = count_s3 + count_s2idle
@@ -277,8 +277,8 @@ class PowerManagementOperation():
'comments': problems,
}
result_filename = os.path.join(self.args.log_dir, '__result')
- with open(result_filename, 'wt') as f:
- json.dump(result, f)
+ with open(result_filename, 'wt') as result_f:
+ json.dump(result, result_f)
if self.args.silent:
logging.info(message)
@@ -298,9 +298,9 @@ class PowerManagementOperation():
# x-terminal-emulator command does not work on Wayland
# Run the checkbox_respawn_cmd via subprocess.run instead
except subprocess.CalledProcessError:
- with open(self.args.checkbox_respawn_cmd, 'rt') as f:
- for l in f:
- subprocess.run(l, shell=True)
+ with open(self.args.checkbox_respawn_cmd, 'rt') as respawn_f:
+ for respawn_cmd in respawn_f:
+ subprocess.run(respawn_cmd, shell=True)
def teardown(self):
"""
@@ -430,6 +430,7 @@ class Command():
Simple subprocess.Popen wrapper to run shell commands
and log their output
"""
+
def __init__(self, command_str, verbose=True):
self.command_str = command_str
self.verbose = verbose
@@ -479,6 +480,7 @@ class CountdownDialog(Gtk.Dialog):
Dialog that shows the amount of progress in the reboot test
and lets the user cancel it if needed
"""
+
def __init__(self, pm_operation, pm_delay, hardware_delay,
iterations, iterations_count):
self.pm_operation = pm_operation
@@ -643,6 +645,7 @@ class MessageDialog():
"""
Simple wrapper aroung Gtk.MessageDialog
"""
+
def __init__(self, title, message, type=Gtk.MessageType.INFO):
self.title = title
self.message = message
@@ -663,6 +666,7 @@ class AutoLoginConfigurator():
Enable/disable autologin configuration
to make sure that reboot test will work properly
"""
+
def __init__(self, user=None):
self.user = user
self.config_filename = '/etc/lightdm/lightdm.conf'
@@ -751,7 +755,6 @@ class SudoersConfigurator():
"{user} ALL=NOPASSWD: /usr/bin/python3' "
"{filename}".format(mark=self.MARK,
user=self.user,
- script=os.path.realpath(__file__),
filename=self.SUDOERS))
Command(command, verbose=False).run()
@@ -891,6 +894,7 @@ class MyArgumentParser():
"""
Command-line argument parser
"""
+
def __init__(self):
"""
Create parser object
diff --git a/bin/removable_storage_test.py b/bin/removable_storage_test.py
index 4dcd5b2..9fd4fd5 100755
--- a/bin/removable_storage_test.py
+++ b/bin/removable_storage_test.py
@@ -19,7 +19,7 @@ gi.require_version('GUdev', '1.0')
from gi.repository import GUdev # noqa: E402
from checkbox_support.dbus import connect_to_system_bus # noqa: E402
-from checkbox_support.dbus.udisks2 import (
+from checkbox_support.dbus.udisks2 import ( # noqa: E402
UDISKS2_BLOCK_INTERFACE,
UDISKS2_DRIVE_INTERFACE,
UDISKS2_FILESYSTEM_INTERFACE,
@@ -28,11 +28,11 @@ from checkbox_support.dbus.udisks2 import (
UDisks2Observer,
is_udisks2_supported,
lookup_udev_device,
- map_udisks1_connection_bus) # noqa: E402
+ map_udisks1_connection_bus)
from checkbox_support.heuristics.udisks2 import is_memory_card # noqa: E402
-from checkbox_support.helpers.human_readable_bytes import (
- HumanReadableBytes) # noqa: E402
-from checkbox_support.parsers.udevadm import (
+from checkbox_support.helpers.human_readable_bytes import ( # noqa: E402
+ HumanReadableBytes)
+from checkbox_support.parsers.udevadm import ( # noqa: E402
CARD_READER_RE,
GENERIC_RE,
FLASH_RE,
diff --git a/units/monitor/jobs.pxu b/units/monitor/jobs.pxu
index ec57b59..55de2c6 100644
--- a/units/monitor/jobs.pxu
+++ b/units/monitor/jobs.pxu
@@ -151,7 +151,7 @@ unit: template
template-resource: graphics_card
template-filter: graphics_card.prime_gpu_offload == 'Off'
id: monitor/{index}_dim_brightness_{product_slug}
-requires: dmi.product in ['Notebook','Laptop','Portable','All In One','All-In-One','AIO']
+requires: dmi.product in ['Notebook','Laptop','Portable','All In One','All-In-One','AIO','Convertible']
plugin: user-interact-verify
category_id: com.canonical.plainbox::monitor
user: root
diff --git a/units/power-management/jobs.pxu b/units/power-management/jobs.pxu
index 8a1a385..20a1c3e 100644
--- a/units/power-management/jobs.pxu
+++ b/units/power-management/jobs.pxu
@@ -79,7 +79,7 @@ plugin: manual
category_id: com.canonical.plainbox::power-management
id: power-management/lid
estimated_duration: 120.0
-requires: dmi.product in ['Notebook','Laptop','Portable']
+requires: dmi.product in ['Notebook','Laptop','Portable','Convertible']
_description:
PURPOSE:
This test will check your lid sensors.
@@ -456,7 +456,7 @@ category_id: com.canonical.plainbox::power-management
id: power-management/light_sensor
estimated_duration: 10.0
requires:
- dmi.product in ['Notebook','Laptop','Portable']
+ dmi.product in ['Notebook','Laptop','Portable','Convertible']
executable.name == 'monitor-sensor'
flags: also-after-suspend
command: light_sensor_test.sh