From: Kamalesh Babulal Date: Tue, 15 Feb 2022 07:03:06 +0000 (+0530) Subject: test-013: make it PEP8 compliant X-Git-Tag: v3.1.0~308^2~2^2~90 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43e54d0fe63e9b3e63a6145c9bd014025f5cd078;p=thirdparty%2Flibcgroup.git test-013: make it PEP8 compliant Make test 013-cgget-multiple_g_flags.py PEP-8 compliant. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/ftests/013-cgget-multiple_g_flags.py b/ftests/013-cgget-multiple_g_flags.py index cbb0c2f6..557f50d3 100755 --- a/ftests/013-cgget-multiple_g_flags.py +++ b/ftests/013-cgget-multiple_g_flags.py @@ -23,9 +23,8 @@ from cgroup import Cgroup, CgroupVersion import consts import ftests -import os -from run import RunError import sys +import os CONTROLLER1 = 'pids' CONTROLLER2 = 'cpu' @@ -63,16 +62,19 @@ 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, CONTROLLER1, CGNAME) Cgroup.create(config, CONTROLLER2, CGNAME) + def test(config): result = consts.TEST_PASSED cause = None @@ -89,19 +91,26 @@ 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): ver1 = CgroupVersion.get_version(CONTROLLER1) ver2 = CgroupVersion.get_version(CONTROLLER2) @@ -115,6 +124,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: @@ -126,6 +136,7 @@ def main(config): return [result, cause] + if __name__ == '__main__': config = ftests.parse_args() # this test was invoked directly. run only it