]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
test-014: make it PEP8 compliant
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Tue, 15 Feb 2022 07:03:28 +0000 (12:33 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Wed, 16 Feb 2022 19:09:18 +0000 (12:09 -0700)
Make test 014-cgget-a_flag.py PEP-8 compliant.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
ftests/014-cgget-a_flag.py

index 102d440d32679c1fc49f0e2d5326c86c7ad52766..1dab554995b4be2b7801b112cff836e17e4a19d6 100755 (executable)
 from cgroup import Cgroup, CgroupVersion
 import consts
 import ftests
-import os
 import sys
+import os
+
+CONTROLLER1 = 'memory'
+CONTROLLER2 = 'cpuset'
+CGNAME = '014cgget'
 
-CONTROLLER1='memory'
-CONTROLLER2='cpuset'
-CGNAME="014cgget"
 
 def prereqs(config):
     result = consts.TEST_PASSED
@@ -36,6 +37,7 @@ def prereqs(config):
 
     return result, cause
 
+
 def setup(config):
     ver1 = CgroupVersion.get_version(CONTROLLER1)
     ver2 = CgroupVersion.get_version(CONTROLLER2)
@@ -49,6 +51,7 @@ def setup(config):
         Cgroup.create(config, CONTROLLER1, CGNAME)
         Cgroup.create(config, CONTROLLER2, CGNAME)
 
+
 def test(config):
     result = consts.TEST_PASSED
     cause = None
@@ -58,25 +61,28 @@ def test(config):
     # arbitrary check to ensure we read several lines
     if len(out.splitlines()) < 20:
         result = consts.TEST_FAILED
-        cause = "Expected multiple lines, but only received {}".format(
-                len(out.splitlines()))
+        cause = (
+                    'Expected multiple lines, but only received {}'
+                    ''.format(len(out.splitlines()))
+                )
         return result, cause
 
     # arbitrary check for a setting that's in both cgroup v1 and cgroup v2
     # memory.stat
-    if not "\tpgmajfault" in out:
+    if '\tpgmajfault' not in out:
         result = consts.TEST_FAILED
-        cause = "Unexpected output\n{}".format(out)
+        cause = 'Unexpected output\n{}'.format(out)
         return result, cause
 
     # make sure that a cpuset value was in the output:
-    if not "cpuset.cpus" in out:
+    if 'cpuset.cpus' not in out:
         result = consts.TEST_FAILED
-        cause = "Failed to find cpuset settings in output\n{}".format(out)
+        cause = 'Failed to find cpuset settings in output\n{}'.format(out)
         return result, cause
 
     return result, cause
 
+
 def teardown(config):
     ver1 = CgroupVersion.get_version(CONTROLLER1)
     ver2 = CgroupVersion.get_version(CONTROLLER2)
@@ -90,6 +96,7 @@ def teardown(config):
         Cgroup.delete(config, CONTROLLER1, CGNAME)
         Cgroup.delete(config, CONTROLLER2, CGNAME)
 
+
 def main(config):
     [result, cause] = prereqs(config)
     if result != consts.TEST_PASSED:
@@ -101,6 +108,7 @@ def main(config):
 
     return [result, cause]
 
+
 if __name__ == '__main__':
     config = ftests.parse_args()
     # this test was invoked directly.  run only it