提交 0ec20a46 编写于 作者: D deveco_test

fix code reivewbot bug

Signed-off-by: Ndeveco_test <liguangjie1@huawei.com>
上级 13ef40e6
...@@ -1768,9 +1768,8 @@ class DexTestDriver(IDriver): ...@@ -1768,9 +1768,8 @@ class DexTestDriver(IDriver):
if not getattr("exception", "error_no", ""): if not getattr("exception", "error_no", ""):
setattr(exception, "error_no", "03203") setattr(exception, "error_no", "03203")
return_message = str(exception.args) return_message = str(exception.args)
finally: shutil.rmtree(long_command_path)
shutil.rmtree(long_command_path) return return_message
return return_message
@staticmethod @staticmethod
def _make_long_command_file(command, longcommand_path, filename): def _make_long_command_file(command, longcommand_path, filename):
...@@ -1785,8 +1784,7 @@ class DexTestDriver(IDriver): ...@@ -1785,8 +1784,7 @@ class DexTestDriver(IDriver):
except(IOError, ValueError) as err_msg: except(IOError, ValueError) as err_msg:
LOG.exception("Error for make long command file: ", err_msg, LOG.exception("Error for make long command file: ", err_msg,
exc_info=False, error_no="03200") exc_info=False, error_no="03200")
finally: return sh_file_name, file_path
return sh_file_name, file_path
def __result__(self): def __result__(self):
return self.result if os.path.exists(self.result) else "" return self.result if os.path.exists(self.result) else ""
......
...@@ -602,8 +602,7 @@ class Device(IDevice): ...@@ -602,8 +602,7 @@ class Device(IDevice):
self._proxy = OpenHarmony(port=self._h_port, addr=self.host, device=self) self._proxy = OpenHarmony(port=self._h_port, addr=self.host, device=self)
except Exception as error: except Exception as error:
self.log.error(' proxy init error: {}.'.format(str(error))) self.log.error(' proxy init error: {}.'.format(str(error)))
finally: return self._proxy
return self._proxy
def start_harmony_rpc(self, port=8080, re_install_rpc=False): def start_harmony_rpc(self, port=8080, re_install_rpc=False):
from devicetest.core.error_message import ErrorMessage from devicetest.core.error_message import ErrorMessage
...@@ -706,8 +705,6 @@ class Device(IDevice): ...@@ -706,8 +705,6 @@ class Device(IDevice):
return ret return ret
except Exception as err: except Exception as err:
self.log.error('DeviceTest-20013 uninstall: %s' % str(err)) self.log.error('DeviceTest-20013 uninstall: %s' % str(err))
finally:
return False
def reconnect(self, waittime=60): def reconnect(self, waittime=60):
''' '''
...@@ -792,8 +789,7 @@ class Device(IDevice): ...@@ -792,8 +789,7 @@ class Device(IDevice):
self.pull_file("/data/screen.png", path) self.pull_file("/data/screen.png", path)
except Exception as error: except Exception as error:
self.log.error("devicetest take_picture: {}".format(str(error))) self.log.error("devicetest take_picture: {}".format(str(error)))
finally: return path
return path
def set_device_report_path(self, path): def set_device_report_path(self, path):
self._device_log_path = path self._device_log_path = path
\ No newline at end of file
...@@ -273,12 +273,11 @@ class DriversThread(threading.Thread): ...@@ -273,12 +273,11 @@ class DriversThread(threading.Thread):
failed_list = params[ReportConst.unsuccessful_params].get(module_name, []) failed_list = params[ReportConst.unsuccessful_params].get(module_name, [])
except Exception: except Exception:
failed_list = params[ReportConst.unsuccessful_params].get(module_name, []) failed_list = params[ReportConst.unsuccessful_params].get(module_name, [])
finally: if not failed_list:
if not failed_list: failed_list = params[ReportConst.unsuccessful_params].get(str(module_name).split(".")[0], [])
failed_list = params[ReportConst.unsuccessful_params].get(str(module_name).split(".")[0], []) unpassed_test_params.extend(failed_list)
unpassed_test_params.extend(failed_list) LOG.debug("Get unpassed test params %s", unpassed_test_params)
LOG.debug("Get unpassed test params %s", unpassed_test_params) return unpassed_test_params
return unpassed_test_params
@classmethod @classmethod
def _append_unpassed_test_param(cls, history_report_file, def _append_unpassed_test_param(cls, history_report_file,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册