From: Kamalesh Babulal Date: Tue, 15 Feb 2022 07:25:13 +0000 (+0530) Subject: test-032: make it PEP8 compliant X-Git-Tag: v3.1.0~308^2~2^2~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4b89f68f31ce55ef85eb0f74fa16771ade00945;p=thirdparty%2Flibcgroup.git test-032: make it PEP8 compliant Make test 032-lscgroup-multiple_g_flags.py PEP-8 compliant. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/ftests/032-lscgroup-multiple_g_flags.py b/ftests/032-lscgroup-multiple_g_flags.py index 03f7c292..6fa80fac 100755 --- a/ftests/032-lscgroup-multiple_g_flags.py +++ b/ftests/032-lscgroup-multiple_g_flags.py @@ -23,9 +23,9 @@ from cgroup import Cgroup, CgroupVersion import consts import ftests -import os -import sys import utils +import sys +import os CONTROLLER = 'cpuset' PARENT_CGNAME = '032lscgroup' @@ -52,6 +52,7 @@ EXPECTED_OUT1 = '''{}:/{}/ CONTROLLER, SIBLING_CGNAME, CONTROLLER, SIBLING_CGNAME, SIBLING_CHILD_CGNAME) + def prereqs(config): result = consts.TEST_PASSED cause = None @@ -68,14 +69,16 @@ def prereqs(config): # properly list the enabled controllers for a cgroup v2 cgroup. # Skip this test because of this result = consts.TEST_SKIPPED - cause = "See Github Issue #50 - lscgroup lists controllers..." + cause = 'See Github Issue #50 - lscgroup lists controllers...' 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.create(config, CONTROLLER, os.path.join(PARENT_CGNAME, CHILD_CGNAME, GRANDCHILD_CGNAME)) @@ -83,6 +86,7 @@ def setup(config): Cgroup.create(config, CONTROLLER, os.path.join(SIBLING_CGNAME, SIBLING_CHILD_CGNAME)) + def test(config): result = consts.TEST_PASSED cause = None @@ -91,24 +95,29 @@ def test(config): path=[PARENT_CGNAME, SIBLING_CGNAME]) if out != EXPECTED_OUT1: result = consts.TEST_FAILED - cause = "Expected lscgroup output doesn't match received output\n" \ - "Expected:\n{}\n" \ - "Received:\n{}\n".format(utils.indent(EXPECTED_OUT1, 4), - utils.indent(out, 4)) + cause = ( + "Expected lscgroup output doesn't match received output\n" + "Expected:\n{}\n" + "Received:\n{}\n" + "".format(utils.indent(EXPECTED_OUT1, 4), + utils.indent(out, 4)) + ) return result, cause ret = Cgroup.lscgroup(config, cghelp=True) - if not "Usage:" in ret: + if 'Usage:' not in ret: result = consts.TEST_FAILED - cause = "Failed to print help text" + cause = 'Failed to print help text' return result, cause return result, cause + def teardown(config): Cgroup.delete(config, CONTROLLER, PARENT_CGNAME, recursive=True) Cgroup.delete(config, CONTROLLER, SIBLING_CGNAME, recursive=True) + def main(config): [result, cause] = prereqs(config) if result != consts.TEST_PASSED: @@ -120,6 +129,7 @@ def main(config): return [result, cause] + if __name__ == '__main__': config = ftests.parse_args() # this test was invoked directly. run only it