]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
ftests/077: drop unused global and fix list sorting
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Wed, 4 Feb 2026 07:27:07 +0000 (12:57 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 19 Mar 2026 17:18:13 +0000 (11:18 -0600)
flake8 reported:
tests/ftests/077-pybindings-cgroup_get_procs.py:52:5: F824  is unused:
name is never assigned in scope

The test already appends to the module-level list, so we do not reassign
it inside setup(). Drop the unused global declaration and call
list.sort() without reassigning the result to keep the pid lists in order
before comparing them.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
tests/ftests/077-pybindings-cgroup_get_procs.py

index 09a9ab75c4e1389fa4d75490ec4f7de1ca72d538..d290e91f245043571173dc4d4bacb7881808d7ee 100755 (executable)
@@ -36,7 +36,6 @@ def prereqs(config):
 
 
 def setup(config):
-    global initial_pid_list
     CgroupCli.create(config, CONTROLLERS, CGNAME)
     CgroupCli.create(config, CONTROLLERS, EMPTY_CGNAME)
 
@@ -45,11 +44,10 @@ def setup(config):
         initial_pid_list.append(pid)
 
     CgroupCli.classify(config, CONTROLLERS, CGNAME, initial_pid_list, ignore_systemd=True)
-    initial_pid_list = initial_pid_list.sort()
+    initial_pid_list.sort()
 
 
 def test(config):
-    global initial_pid_list
     result = consts.TEST_PASSED
     cause = None
 
@@ -59,7 +57,8 @@ def test(config):
     cg = Cgroup(CGNAME, Version.CGROUP_V2)
     for controller in CONTROLLERS:
         cg.add_controller(controller)
-    pid_list = cg.get_processes().sort()
+    pid_list = cg.get_processes()
+    pid_list.sort()
 
     if pid_list != initial_pid_list:
         result = consts.TEST_FAILED