From: Kamalesh Babulal Date: Tue, 15 Feb 2022 07:02:25 +0000 (+0530) Subject: test-011: make it PEP8 compliant X-Git-Tag: v3.1.0~308^2~2^2~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=252b6472ee4ebb11bb0faf69727ab7967049b6fe;p=thirdparty%2Flibcgroup.git test-011: make it PEP8 compliant Make test 011-cgget-r_flag_two_cgroups.py PEP-8 compliant. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/ftests/011-cgget-r_flag_two_cgroups.py b/ftests/011-cgget-r_flag_two_cgroups.py index e879d771..0643da0b 100755 --- a/ftests/011-cgget-r_flag_two_cgroups.py +++ b/ftests/011-cgget-r_flag_two_cgroups.py @@ -23,8 +23,8 @@ from cgroup import Cgroup, CgroupVersion import consts import ftests -import os import sys +import os CONTROLLER = 'memory' CGNAME1 = '011cgget1' @@ -48,12 +48,14 @@ memory.max: 2048000 memory.max: 2048000 ''' + def prereqs(config): result = consts.TEST_PASSED cause = None return result, cause + def setup(config): Cgroup.create(config, CONTROLLER, CGNAME1) Cgroup.create(config, CONTROLLER, CGNAME2) @@ -67,6 +69,7 @@ def setup(config): Cgroup.set(config, CGNAME1, SETTING_V2, VALUE) Cgroup.set(config, CGNAME2, SETTING_V2, VALUE) + def test(config): result = consts.TEST_PASSED cause = None @@ -86,16 +89,21 @@ def test(config): 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, CGNAME1) Cgroup.delete(config, CONTROLLER, CGNAME2) + def main(config): [result, cause] = prereqs(config) if result != consts.TEST_PASSED: @@ -107,6 +115,7 @@ def main(config): return [result, cause] + if __name__ == '__main__': config = ftests.parse_args() # this test was invoked directly. run only it