From: Kamalesh Babulal Date: Tue, 15 Feb 2022 07:01:23 +0000 (+0530) Subject: test-009: make it PEP8 compliant X-Git-Tag: v3.1.0~308^2~2^2~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a2710f13903966f8da4aa6928e3388aaa3c2fad;p=thirdparty%2Flibcgroup.git test-009: make it PEP8 compliant Make test 009-cgget-g_flag_controller_only.py PEP-8 compliant. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/ftests/009-cgget-g_flag_controller_only.py b/ftests/009-cgget-g_flag_controller_only.py index 388f553b..f59562b4 100755 --- a/ftests/009-cgget-g_flag_controller_only.py +++ b/ftests/009-cgget-g_flag_controller_only.py @@ -23,8 +23,8 @@ from cgroup import Cgroup, CgroupVersion import consts import ftests -import os import sys +import os CONTROLLER = 'cpu' CGNAME = '009cgget' @@ -55,15 +55,18 @@ cpu.uclamp.min: 0.00 cpu.uclamp.max: max ''' + def prereqs(config): result = consts.TEST_PASSED cause = None return result, cause + def setup(config): Cgroup.create(config, CONTROLLER, CGNAME) + def test(config): result = consts.TEST_PASSED cause = None @@ -79,22 +82,30 @@ def test(config): if len(out.splitlines()) != len(expected_out.splitlines()): result = consts.TEST_FAILED - cause = "Expected {} lines but received {} lines".format( - len(expected_out.splitlines()), len(out.splitlines())) + cause = ( + 'Expected {} lines but received {} lines' + ''.format(len(expected_out.splitlines()), + len(out.splitlines())) + ) return result, cause for line_num, line in enumerate(out.splitlines()): if line.strip() != expected_out.splitlines()[line_num].strip(): result = consts.TEST_FAILED - cause = "Expected line:\n\t{}\nbut received line:\n\t{}".format( - expected_out.splitlines()[line_num].strip(), line.strip()) + cause = ( + 'Expected line:\n\t{}\nbut received line:\n\t{}' + ''.format(expected_out.splitlines()[line_num].strip(), + line.strip()) + ) return result, cause return result, cause + def teardown(config): Cgroup.delete(config, CONTROLLER, CGNAME) + def main(config): [result, cause] = prereqs(config) if result != consts.TEST_PASSED: @@ -106,6 +117,7 @@ def main(config): return [result, cause] + if __name__ == '__main__': config = ftests.parse_args() # this test was invoked directly. run only it