From: Kamalesh Babulal Date: Tue, 15 Feb 2022 07:04:38 +0000 (+0530) Subject: test-017: make it PEP8 compliant X-Git-Tag: v3.1.0~308^2~2^2~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c78a567d7fb030e553c5fe34d5dad0450fa45ea2;p=thirdparty%2Flibcgroup.git test-017: make it PEP8 compliant Make test 017-cgconfig-load_file.py PEP-8 compliant. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/ftests/017-cgconfig-load_file.py b/ftests/017-cgconfig-load_file.py index 4a73f1ce..5f27a4ea 100755 --- a/ftests/017-cgconfig-load_file.py +++ b/ftests/017-cgconfig-load_file.py @@ -23,8 +23,8 @@ from cgroup import Cgroup, CgroupVersion import consts import ftests -import os import sys +import os CONTROLLER = 'cpu' CGNAME = '017cgconfig' @@ -43,22 +43,25 @@ CONFIG_FILE = '''group CONFIG_FILE_NAME = os.path.join(os.getcwd(), '017cgconfig.conf') + def prereqs(config): result = consts.TEST_PASSED cause = None if CgroupVersion.get_version('cpu') != CgroupVersion.CGROUP_V1: result = consts.TEST_SKIPPED - cause = "This test requires the cgroup v1 cpu controller" + cause = 'This test requires the cgroup v1 cpu controller' return result, cause return result, cause + def setup(config): f = open(CONFIG_FILE_NAME, 'w') f.write(CONFIG_FILE) f.close() + def test(config): Cgroup.configparser(config, load_file=CONFIG_FILE_NAME) @@ -68,10 +71,12 @@ def test(config): return consts.TEST_PASSED, None + def teardown(config): Cgroup.delete(config, CONTROLLER, CGNAME) os.remove(CONFIG_FILE_NAME) + def main(config): [result, cause] = prereqs(config) if result != consts.TEST_PASSED: @@ -85,6 +90,7 @@ def main(config): return [result, cause] + if __name__ == '__main__': config = ftests.parse_args() # this test was invoked directly. run only it