Bug 1110817 - [mozdevice] - adb_android.is_device_ready - UnboundLocalError: local variable 'data' referenced before assignment, r=wlach.

This commit is contained in:
Bob Clary 2014-12-14 18:18:39 -08:00
parent cf6709f516
commit afea3926fa

View File

@ -73,9 +73,12 @@ class ADBAndroidMixin(object):
"instrumentation", "features", "libraries"]
ready_path = os.path.join(self.test_root, "ready")
for attempt in range(self._device_ready_retry_attempts):
failure = 'Unknown failure'
success = True
try:
if self.get_state(timeout=timeout) != 'device':
state = self.get_state(timeout=timeout)
if state != 'device':
failure = "Device state: %s" % state
success = False
else:
if self.is_dir(ready_path, timeout=timeout):
@ -88,16 +91,17 @@ class ADBAndroidMixin(object):
data = self.shell_output("pm list %s" % pm_list_cmd,
timeout=timeout)
if pm_error_string in data:
failure = data
success = False
break
except ADBError, e:
success = False
data = e.message
failure = e.message
if not success:
self._logger.debug('Attempt %s of %s device not ready: %s' % (
attempt+1, self._device_ready_retry_attempts,
data))
failure))
time.sleep(self._device_ready_retry_wait)
return success