Fix PyLint: Consider explicitly re-raising

This commit is contained in:
Ivan Kravets committed 2022-07-02 18:37:57 +03:00
1 parent f01cd7570c
commit 19d518fc4c
45 files changed
+136 -138

No files matched your search

+4 -4
View File
@@ -128,11 +128,11 @@ class TestRunnerBase:
targets.append("checkprogsize")
try:
return self.run_project_targets(targets)
except ReturnErrorCode:
except ReturnErrorCode as exc:
raise UnitTestSuiteError(
"Building stage has failed, see errors above. "
"Use `pio test -vvv` option to enable verbose output."
)
) from exc
def stage_uploading(self):
is_embedded = self.platform.is_embedded()
@@ -150,11 +150,11 @@ class TestRunnerBase:
targets.append("__debug")
try:
return self.run_project_targets(targets)
except ReturnErrorCode:
except ReturnErrorCode as exc:
raise UnitTestSuiteError(
"Uploading stage has failed, see errors above. "
"Use `pio test -vvv` option to enable verbose output."
)
) from exc
def stage_testing(self):
if self.options.without_testing:
+2 -2
View File
@@ -56,11 +56,11 @@ class TestRunnerFactory(object):
try:
mod = load_python_module(module_name, custom_runner_path)
except (FileNotFoundError, ImportError):
except (FileNotFoundError, ImportError) as exc:
raise UserSideException(
"Could not find custom test runner "
f"by this path -> {custom_runner_path}"
)
) from exc
else:
mod = importlib.import_module(module_name)
runner_cls = getattr(mod, cls.get_clsname(test_framework))
+2 -2
View File
@@ -108,8 +108,8 @@ class ProgramTestOutputReader:
raise UnitTestError(
f"Program received signal {sig.name} ({signal_description})"
)
except ValueError:
raise UnitTestError("Program errored with %d code" % return_code)
except ValueError as exc:
raise UnitTestError("Program errored with %d code" % return_code) from exc
def begin(self):
try:
+2 -2
View File
@@ -45,8 +45,8 @@ class SerialTestOutputReader:
ser.rts = self.test_runner.options.monitor_rts
ser.dtr = self.test_runner.options.monitor_dtr
ser.open()
except serial.SerialException as e:
click.secho(str(e), fg="red", err=True)
except serial.SerialException as exc:
click.secho(str(exc), fg="red", err=True)
return None
if not self.test_runner.options.no_reset: