From: Kamalesh Babulal Date: Tue, 15 Feb 2022 07:21:23 +0000 (+0530) Subject: test-023: make it PEP8 compliant X-Git-Tag: v3.1.0~308^2~2^2~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b02365ec6f65336d4f1b2c27d300244ad281972d;p=thirdparty%2Flibcgroup.git test-023: make it PEP8 compliant Make test 023-cgset-copy_from.py PEP-8 compliant. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/ftests/023-cgset-copy_from.py b/ftests/023-cgset-copy_from.py index 3a7aac54..d3f22de9 100755 --- a/ftests/023-cgset-copy_from.py +++ b/ftests/023-cgset-copy_from.py @@ -23,8 +23,8 @@ from cgroup import Cgroup, CgroupVersion import consts import ftests -import os import sys +import os CONTROLLER = 'memory' SRC_CGNAME = '023cgsetsrc' @@ -35,22 +35,25 @@ SETTINGS = ['memory.limit_in_bytes', 'memory.swappiness'] VALUES = ['122880', '40960', '42'] + def prereqs(config): result = consts.TEST_PASSED cause = None if CgroupVersion.get_version('memory') != CgroupVersion.CGROUP_V1: result = consts.TEST_SKIPPED - cause = "This test requires the cgroup v1 memory controller" + cause = 'This test requires the cgroup v1 memory controller' return result, cause return result, cause + def setup(config): Cgroup.create(config, CONTROLLER, SRC_CGNAME) Cgroup.create(config, CONTROLLER, DST_CGNAME) Cgroup.set(config, cgname=SRC_CGNAME, setting=SETTINGS, value=VALUES) + def test(config): Cgroup.set(config, cgname=DST_CGNAME, copy_from=SRC_CGNAME) @@ -59,10 +62,12 @@ def test(config): return consts.TEST_PASSED, None + def teardown(config): Cgroup.delete(config, CONTROLLER, SRC_CGNAME) Cgroup.delete(config, CONTROLLER, DST_CGNAME) + def main(config): [result, cause] = prereqs(config) if result != consts.TEST_PASSED: @@ -74,6 +79,7 @@ def main(config): return [result, cause] + if __name__ == '__main__': config = ftests.parse_args() # this test was invoked directly. run only it