From: Kamalesh Babulal Date: Thu, 17 Feb 2022 11:17:29 +0000 (+0530) Subject: run.py: make it PEP8 compliant X-Git-Tag: v3.1.0~308^2~2^2~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f7b18e757fb2ce1cb77452c8a54c6125dc5dd26;p=thirdparty%2Flibcgroup.git run.py: make it PEP8 compliant Make run.py PEP-8 compliant. Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/ftests/run.py b/ftests/run.py index 83fbc058..ef837083 100644 --- a/ftests/run.py +++ b/ftests/run.py @@ -21,7 +21,7 @@ from log import Log import subprocess -import time + class Run(object): @staticmethod @@ -46,18 +46,22 @@ class Run(object): if shell_bool: Log.log_debug( - "run:\n\tcommand = {}\n\tret = {}\n\tstdout = {}\n\tstderr = {}".format( - command, ret, out, err)) + 'run:\n\tcommand = {}\n\tret = {}\n\tstdout = {}' + '\n\tstderr = {}' + ''.format(command, ret, out, err) + ) else: Log.log_debug( - "run:\n\tcommand = {}\n\tret = {}\n\tstdout = {}\n\tstderr = {}".format( - ' '.join(command), ret, out, err)) + 'run:\n\tcommand = {}\n\tret = {}\n\tstdout = {}' + '\n\tstderr = {}' + ''.format(' '.join(command), ret, out, err) + ) if ret != 0: raise RunError("Command '{}' failed".format(''.join(command)), command, ret, out, err) if ret != 0 or len(err) > 0: - if err.find("WARNING: cgroup v2 is not fully supported yet") == -1: + if err.find('WARNING: cgroup v2 is not fully supported yet') == -1: # LXD throws the above warning on systems that are fully # running cgroup v2. Ignore this warning, but fail if any # other warnings/errors are raised @@ -66,6 +70,7 @@ class Run(object): return out + class RunError(Exception): def __init__(self, message, command, ret, stdout, stderr): super(RunError, self).__init__(message) @@ -76,9 +81,10 @@ class RunError(Exception): self.stderr = stderr def __str__(self): - out_str = "RunError:\n\tcommand = {}\n\tret = {}".format( + out_str = 'RunError:\n\tcommand = {}\n\tret = {}'.format( self.command, self.ret) - out_str += "\n\tstdout = {}\n\tstderr = {}".format(self.stdout, self.stderr) + out_str += '\n\tstdout = {}\n\tstderr = {}'.format(self.stdout, + self.stderr) return out_str # vim: set et ts=4 sw=4: