mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1681096 - python3 - pylint --py3k - W1645: Exception.message removed in Python 3 (exception-message-attribute) r=marionette-reviewers,aki,gbrown,maja_zf
Differential Revision: https://phabricator.services.mozilla.com/D99059
This commit is contained in:
parent
bb0c6d5f7d
commit
48ee50e6e3
@ -35,6 +35,7 @@ class MarionetteException(Exception):
|
||||
self._message = six.text_type(message)
|
||||
|
||||
def __str__(self):
|
||||
# pylint: disable=W1645
|
||||
msg = self.message
|
||||
tb = None
|
||||
|
||||
|
@ -104,7 +104,7 @@ def cli(
|
||||
if failed > 0:
|
||||
sys.exit(10)
|
||||
except Exception as e:
|
||||
logger.error(e.message, exc_info=True)
|
||||
logger.error(str(e), exc_info=True)
|
||||
sys.exit(1)
|
||||
sys.exit(0)
|
||||
|
||||
|
@ -265,12 +265,12 @@ def test_load_testvars_throws_expected_errors(mach_parsed_kwargs):
|
||||
runner = MarionetteTestRunner(**mach_parsed_kwargs)
|
||||
with pytest.raises(IOError) as io_exc:
|
||||
runner._load_testvars()
|
||||
assert "does not exist" in io_exc.value.message
|
||||
assert "does not exist" in str(io_exc.value)
|
||||
with patch("os.path.exists", return_value=True):
|
||||
with patch("__builtin__.open", mock_open(read_data="[not {valid JSON]")):
|
||||
with pytest.raises(Exception) as json_exc:
|
||||
runner._load_testvars()
|
||||
assert "not properly formatted" in json_exc.value.message
|
||||
assert "not properly formatted" in str(json_exc.value)
|
||||
|
||||
|
||||
def _check_crash_counts(has_crashed, runner, mock_marionette):
|
||||
@ -504,7 +504,7 @@ def test_catch_invalid_test_names(runner):
|
||||
]
|
||||
with pytest.raises(Exception) as exc:
|
||||
runner._add_tests(good_tests + bad_tests)
|
||||
msg = exc.value.message
|
||||
msg = str(exc.value)
|
||||
assert "Test file names must be of the form" in msg
|
||||
for bad_name in bad_tests:
|
||||
assert bad_name in msg
|
||||
|
@ -80,7 +80,7 @@ class TestRunner(object):
|
||||
func()
|
||||
except TestAssertion as e:
|
||||
status = "FAIL"
|
||||
message = e.message
|
||||
message = str(e)
|
||||
except Exception:
|
||||
status = "ERROR"
|
||||
message = traceback.format_exc()
|
||||
|
@ -84,7 +84,7 @@ class Copy(CLICommand):
|
||||
try:
|
||||
kwargs, tags, args = parse_args(args)
|
||||
except ParserError as e:
|
||||
self._parser.error(e.message)
|
||||
self._parser.error(str(e))
|
||||
|
||||
# make sure we have some manifests, otherwise it will
|
||||
# be quite boring
|
||||
@ -165,7 +165,7 @@ class WriteCLI(CLICommand):
|
||||
try:
|
||||
kwargs, tags, args = parse_args(args)
|
||||
except ParserError as e:
|
||||
self._parser.error(e.message)
|
||||
self._parser.error(str(e))
|
||||
|
||||
# make sure we have some manifests, otherwise it will
|
||||
# be quite boring
|
||||
@ -211,7 +211,7 @@ class UpdateCLI(CLICommand):
|
||||
try:
|
||||
kwargs, tags, args = parse_args(args)
|
||||
except ParserError as e:
|
||||
self._parser.error(e.message)
|
||||
self._parser.error(str(e))
|
||||
|
||||
# make sure we have some manifests, otherwise it will
|
||||
# be quite boring
|
||||
|
@ -38,8 +38,9 @@ class LocationError(Exception):
|
||||
|
||||
def __str__(self):
|
||||
s = "Bad location"
|
||||
if self.message:
|
||||
s += ": %s" % self.message
|
||||
m = str(Exception.__str__(self))
|
||||
if m:
|
||||
s += ": %s" % m
|
||||
return s
|
||||
|
||||
|
||||
|
@ -1930,7 +1930,7 @@ class ScriptMixin(PlatformMixin):
|
||||
os.chmod(fname, mode)
|
||||
except zipfile.BadZipfile as e:
|
||||
self.log(
|
||||
"%s (%s)" % (e.message, filename),
|
||||
"%s (%s)" % (str(e), filename),
|
||||
level=error_level,
|
||||
exit_code=fatal_exit_code,
|
||||
)
|
||||
@ -1948,7 +1948,7 @@ class ScriptMixin(PlatformMixin):
|
||||
bundle.extract(entry, path=extract_to)
|
||||
except tarfile.TarError as e:
|
||||
self.log(
|
||||
"%s (%s)" % (e.message, filename),
|
||||
"%s (%s)" % (str(e), filename),
|
||||
level=error_level,
|
||||
exit_code=fatal_exit_code,
|
||||
)
|
||||
|
@ -281,5 +281,5 @@ class MachCommands(MachCommandBase):
|
||||
try:
|
||||
return xpcshell.run_test(**params)
|
||||
except InvalidTestPathError as e:
|
||||
print(e.message)
|
||||
print(str(e))
|
||||
return 1
|
||||
|
Loading…
Reference in New Issue
Block a user