Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for pylint 2.17.2 (Fedora 38) #5708

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -541,5 +541,5 @@ valid-metaclass-classmethod-first-arg=cls

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception
2 changes: 1 addition & 1 deletion avocado/utils/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def make(
:returns: exit status of the make process
"""

kwargs = dict(env=env, ignore_status=ignore_status)
kwargs = {"env": env, "ignore_status": ignore_status}
if process_kwargs is not None:
kwargs.update(process_kwargs)
result = run_make(path, make, extra_args, kwargs)
Expand Down
10 changes: 7 additions & 3 deletions avocado/utils/external/gdbmi_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
from avocado.utils.external import spark


class GdbMiException(Exception):
pass


class Token:
def __init__(self, token_type, value=None):
self.type = token_type
Expand Down Expand Up @@ -126,7 +130,7 @@ def t_c_string(self, s):

def t_default(self, s): # pylint: disable=W0221
r"( . | \n )+"
raise Exception(f"Specification error: unmatched input for '{s}'")
raise GdbMiException(f"Specification error: unmatched input for '{s}'")

@staticmethod
def __unescape(s):
Expand Down Expand Up @@ -200,7 +204,7 @@ def nonterminal(self, token_type, args):
def error(self, token, i=0, tokens=None): # pylint: disable=W0221
if i > 2:
print(f"{tokens[i - 3]} {tokens[i - 2]} " f"{tokens[i - 1]} {tokens[i]}")
raise Exception(f"Syntax error at or near {int(i)}:'{token}' token")
raise GdbMiException(f"Syntax error at or near {int(i)}:'{token}' token")


class GdbMiInterpreter(spark.GenericASTTraversal):
Expand Down Expand Up @@ -249,7 +253,7 @@ def n_tuple(node):
else:
node.value[n] = v
else:
raise Exception("Invalid tuple")
raise GdbMiException("Invalid tuple")
# print 'tuple: %s' % node.value

@staticmethod
Expand Down
4 changes: 3 additions & 1 deletion avocado/utils/gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,9 @@ def cmd(self, command):
if result_response_received:
# raise an exception here, because no two result
# responses should come from a single command AFAIK
raise Exception("Many result responses to a single cmd")
raise UnexpectedResponseError(
"Many result responses to a single cmd"
)
result_response_received = True
cmd.result = parsed_response
else:
Expand Down
2 changes: 1 addition & 1 deletion avocado/utils/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def uncompress(self):
LOG.info("Uncompressing tarball")
archive.extract(self.asset_path, self.work_dir)
else:
raise Exception("Unable to find the tarball")
raise RuntimeError("Unable to find the tarball")

def configure(self, targets=("defconfig"), extra_configs=None):
"""
Expand Down
2 changes: 1 addition & 1 deletion examples/tests/multiple_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ def action():
"""
This method should never execute
"""
raise Exception("This action method should never be executed.")
raise RuntimeError("This action method should never be executed.")
2 changes: 1 addition & 1 deletion examples/tests/uncaught_exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ def test():
"""
This should end with ERROR.
"""
raise Exception("This is a generic exception")
raise Exception("This is a generic exception") # pylint: disable=W0719
6 changes: 3 additions & 3 deletions selftests/.data/test_statuses.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class ExitSetup(Test):
def setUp(self):
self.log.info("setup pre")
sys.exit(-1)
self.log.info("setup post")
self.log.info("setup post") # pylint: disable=W0101

def test(self):
self.log.info("test pre")
Expand All @@ -219,7 +219,7 @@ def setUp(self):
def test(self):
self.log.info("test pre")
sys.exit(-1)
self.log.info("test post")
self.log.info("test post") # pylint: disable=W0101

def tearDown(self):
self.log.info("teardown pre")
Expand All @@ -240,7 +240,7 @@ def tearDown(self):
self.log.info("teardown pre")
self.log.info("teardown status: %s", self.status)
sys.exit(-1)
self.log.info("teardown post")
self.log.info("teardown post") # pylint: disable=W0101


class ExceptionSetup(Test):
Expand Down