From: Kamalesh Babulal Date: Tue, 15 Feb 2022 07:02:43 +0000 (+0530) Subject: test-012: make it PEP8 compliant X-Git-Tag: v3.1.0~308^2~2^2~91 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e3f66292b08670babd7e0aaa7fbd66631242cdb;p=thirdparty%2Flibcgroup.git test-012: make it PEP8 compliant Make test 012-cgget-multiple_r_flags2.py PEP-8 compliant. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/ftests/012-cgget-multiple_r_flags2.py b/ftests/012-cgget-multiple_r_flags2.py index a70cb423..2d8ed1ba 100755 --- a/ftests/012-cgget-multiple_r_flags2.py +++ b/ftests/012-cgget-multiple_r_flags2.py @@ -23,8 +23,8 @@ from cgroup import Cgroup, CgroupVersion import consts import ftests -import os import sys +import os CONTROLLER = 'memory' CGNAME1 = '012cgget1' @@ -47,12 +47,14 @@ EXPECTED_OUT = '''{}: {} '''.format(CGNAME1, VALUE1, VALUE2, CGNAME2, VALUE1, VALUE2) + 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) @@ -70,6 +72,7 @@ def setup(config): Cgroup.set(config, CGNAME2, SETTING1_V2, VALUE1) Cgroup.set(config, CGNAME2, SETTING2_V2, VALUE2) + def test(config): result = consts.TEST_PASSED cause = None @@ -87,16 +90,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: @@ -108,6 +116,7 @@ def main(config): return [result, cause] + if __name__ == '__main__': config = ftests.parse_args() # this test was invoked directly. run only it