From: Kamalesh Babulal Date: Tue, 15 Feb 2022 07:03:45 +0000 (+0530) Subject: test-015: make it PEP8 compliant X-Git-Tag: v3.1.0~308^2~2^2~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fab59f45102230c81b57b522033515a4e7fcb126;p=thirdparty%2Flibcgroup.git test-015: make it PEP8 compliant Make test 015-cgget-multiline_r_flag.py PEP-8 compliant. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/ftests/015-cgget-multiline_r_flag.py b/ftests/015-cgget-multiline_r_flag.py index 38850a91..f1745469 100755 --- a/ftests/015-cgget-multiline_r_flag.py +++ b/ftests/015-cgget-multiline_r_flag.py @@ -20,17 +20,18 @@ # along with this library; if not, see . # -from cgroup import Cgroup, CgroupVersion +from cgroup import Cgroup import consts import ftests -import os import sys +import os -CONTROLLER='memory' -CGNAME="015cgget" +CONTROLLER = 'memory' +CGNAME = '015cgget' + +SETTING = 'memory.stat' +VALUE = '512' -SETTING='memory.stat' -VALUE='512' def prereqs(config): result = consts.TEST_PASSED @@ -38,9 +39,11 @@ def prereqs(config): return result, cause + def setup(config): Cgroup.create(config, CONTROLLER, CGNAME) + def test(config): result = consts.TEST_PASSED cause = None @@ -52,22 +55,26 @@ def test(config): # arbitrary check to ensure we read several lines if len(out.splitlines()) < 10: result = consts.TEST_FAILED - cause = "Expected multiple lines, but only received {}".format( - len(out.splitlines())) + cause = ( + 'Expected multiple lines, but only received {}' + ''.format(len(out.splitlines())) + ) return result, cause # arbitrary check for a setting that's in both cgroup v1 and cgroup v2 # memory.stat - if not "\tunevictable" in out: + if '\tunevictable' not in out: result = consts.TEST_FAILED - cause = "Unexpected output\n{}".format(out) + cause = 'Unexpected output\n{}'.format(out) 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: @@ -79,6 +86,7 @@ def main(config): return [result, cause] + if __name__ == '__main__': config = ftests.parse_args() # this test was invoked directly. run only it