]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
test-006: make it PEP8 compliant
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Tue, 15 Feb 2022 06:59:47 +0000 (12:29 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 16 Feb 2022 19:09:18 +0000 (12:09 -0700)
Make test 006-cgrules-basic_cgrules_v1.py PEP-8 compliant.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
ftests/006-cgrules-basic_cgrules_v1.py

index bf1f93888c048acde3393ab62c0785454048e5e2..e18186adb16788dae91321b133d589a5546db592 100755 (executable)
 #
 
 from cgroup import Cgroup, CgroupVersion
+from process import Process
 import consts
 import ftests
-import os
-from process import Process
 import sys
+import os
 
-CONTROLLER='cpu'
-PARENT_CGNAME='006cgrules'
-CHILD_CGNAME='childcg'
+CONTROLLER = 'cpu'
+PARENT_CGNAME = '006cgrules'
+CHILD_CGNAME = 'childcg'
 
 # move all perl processes to the 006cgrules/childcg cgroup in the
 # cpu controller
-CGRULE="*:/usr/bin/perl cpu {}".format(os.path.join(PARENT_CGNAME, CHILD_CGNAME))
+CGRULE = (
+            '*:/usr/bin/perl cpu {}'
+            ''.format(os.path.join(PARENT_CGNAME, CHILD_CGNAME))
+         )
 
 cg = Cgroup(os.path.join(PARENT_CGNAME, CHILD_CGNAME))
 
+
 def prereqs(config):
     result = consts.TEST_PASSED
     cause = None
 
     if config.args.container:
         result = consts.TEST_SKIPPED
-        cause = "This test cannot be run within a container"
+        cause = 'This test cannot be run within a container'
         return result, cause
 
     if CgroupVersion.get_version('cpu') != CgroupVersion.CGROUP_V1:
         result = consts.TEST_SKIPPED
-        cause = "This test requires the cgroup v1 cpu controller"
+        cause = 'This test requires the cgroup v1 cpu controller'
         return result, cause
 
     return result, cause
 
+
 def setup(config):
     Cgroup.create(config, CONTROLLER, PARENT_CGNAME)
-    Cgroup.create(config, CONTROLLER, os.path.join(PARENT_CGNAME, CHILD_CGNAME))
+    Cgroup.create(config, CONTROLLER,
+                  os.path.join(PARENT_CGNAME, CHILD_CGNAME))
 
     Cgroup.set_cgrules_conf(config, CGRULE, append=False)
     cg.start_cgrules(config)
 
+
 def test(config):
     result = consts.TEST_PASSED
     cause = None
@@ -70,17 +77,24 @@ def test(config):
     # proc/{pid}/cgroup alsways prepends a '/' to the cgroup path
     if proc_cgroup != os.path.join('/', PARENT_CGNAME, CHILD_CGNAME):
         result = consts.TEST_FAILED
-        cause = "PID {} was expected to be in cgroup {} but is in cgroup {}".format(
-                    pid, os.path.join('/', PARENT_CGNAME, CHILD_CGNAME), proc_cgroup)
+        cause = (
+                    'PID {} was expected to be in cgroup {} but is in '
+                    'cgroup {}'
+                    ''.format(pid,
+                              os.path.join('/', PARENT_CGNAME, CHILD_CGNAME),
+                              proc_cgroup)
+                )
 
     return result, cause
 
+
 def teardown(config):
     # destroy the child processes
     config.process.join_children(config)
     cg.join_children(config)
     Cgroup.delete(config, CONTROLLER, PARENT_CGNAME, recursive=True)
 
+
 def main(config):
     [result, cause] = prereqs(config)
     if result != consts.TEST_PASSED:
@@ -94,6 +108,7 @@ def main(config):
 
     return [result, cause]
 
+
 if __name__ == '__main__':
     config = ftests.parse_args()
     # this test was invoked directly.  run only it