From: Kamalesh Babulal Date: Tue, 15 Feb 2022 07:27:04 +0000 (+0530) Subject: test-036: make it PEP8 compliant X-Git-Tag: v3.1.0~308^2~2^2~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79637a890faa5596ff4b614ce935a10587e4ebdd;p=thirdparty%2Flibcgroup.git test-036: make it PEP8 compliant Make test 036-cgset-multi_thread.py PEP-8 compliant. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/ftests/036-cgset-multi_thread.py b/ftests/036-cgset-multi_thread.py index 592ed9b3..a38b6647 100755 --- a/ftests/036-cgset-multi_thread.py +++ b/ftests/036-cgset-multi_thread.py @@ -35,22 +35,24 @@ SETTING = 'cgroup.type' AFTER = 'threaded' THREADS = 3 + 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(CONTROLLER) != CgroupVersion.CGROUP_V2: result = consts.TEST_SKIPPED - cause = "This test requires the cgroup v2" + cause = 'This test requires the cgroup v2' return result, cause return result, cause + def setup(config): Cgroup.create(config, CONTROLLER, PARENT_CGNAME) Cgroup.create(config, CONTROLLER, CHILD_CGPATH) @@ -59,22 +61,24 @@ def setup(config): return consts.TEST_PASSED, None + def test(config): config.process.create_threaded_process_in_cgroup( config, CONTROLLER, PARENT_CGNAME, THREADS) threads = Cgroup.get(config, controller=None, cgname=PARENT_CGNAME, - setting="cgroup.threads", print_headers=False, + setting='cgroup.threads', print_headers=False, values_only=True) threads = threads.replace('\n', '').split('\t') - #pick the first thread +# #pick the first thread thread_tid = threads[1] - Cgroup.set_and_validate(config, CHILD_CGPATH, "cgroup.threads", thread_tid) + Cgroup.set_and_validate(config, CHILD_CGPATH, 'cgroup.threads', thread_tid) return consts.TEST_PASSED, None + def teardown(config): # destroy the child processes pids = Cgroup.get_pids_in_cgroup(config, PARENT_CGNAME, CONTROLLER) @@ -84,6 +88,7 @@ def teardown(config): Cgroup.delete(config, CONTROLLER, PARENT_CGNAME, recursive=True) + def main(config): [result, cause] = prereqs(config) if result != consts.TEST_PASSED: @@ -97,6 +102,7 @@ def main(config): return [result, cause] + if __name__ == '__main__': config = ftests.parse_args() # this test was invoked directly. run only it