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

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
ftests/034-cgexec-basic_cgexec.py

index cb1819306d5e4279deb37880429b1dde8d1ec835..b16e7f1023b2cf10fa4aea022cc7f80a0d140c79 100755 (executable)
 # along with this library; if not, see <http://www.gnu.org/licenses>.
 #
 
-from cgroup import Cgroup, CgroupVersion
+from cgroup import Cgroup
+from run import Run
 import consts
 import ftests
-import os
-from process import Process
-from run import Run
 import sys
+import os
 
-import time
 
 CONTROLLER = 'cpuset'
 CGNAME = '034cgexec'
 
+
 def prereqs(config):
     if not config.args.container:
         result = consts.TEST_SKIPPED
-        cause = "This test must be run within a container"
+        cause = 'This test must be run within a container'
         return result, cause
 
     return consts.TEST_PASSED, None
 
+
 def setup(config):
     Cgroup.create(config, CONTROLLER, CGNAME)
 
+
 def test(config):
     config.process.create_process_in_cgroup(config, CONTROLLER, CGNAME,
                                             cgclassify=False)
@@ -51,19 +52,20 @@ def test(config):
     pids = Cgroup.get_pids_in_cgroup(config, CGNAME, CONTROLLER)
     if pids is None:
         result = consts.TEST_FAILED
-        cause = "No processes were found in cgroup {}".format(CGNAME)
+        cause = 'No processes were found in cgroup {}'.format(CGNAME)
         return result, cause
 
     # run cgexec -h
     ret = Cgroup.cgexec(config, controller=CONTROLLER, cgname=CGNAME,
                         cmdline=None, cghelp=True)
-    if not "Run the task in given control group(s)" in ret:
+    if 'Run the task in given control group(s)' not in ret:
         result = consts.TEST_FAILED
-        cause = "Failed to print cgexec help text: {}".format(ret)
+        cause = 'Failed to print cgexec help text: {}'.format(ret)
         return result, cause
 
     return consts.TEST_PASSED, None
 
+
 def teardown(config):
     pids = Cgroup.get_pids_in_cgroup(config, CGNAME, CONTROLLER)
     if pids:
@@ -75,6 +77,7 @@ def teardown(config):
 
     Cgroup.delete(config, CONTROLLER, CGNAME)
 
+
 def main(config):
     [result, cause] = prereqs(config)
     if result != consts.TEST_PASSED:
@@ -86,6 +89,7 @@ def main(config):
 
     return [result, cause]
 
+
 if __name__ == '__main__':
     config = ftests.parse_args()
     # this test was invoked directly.  run only it