From afea3926fa614958790cedf855d2f4ecaa8e164c Mon Sep 17 00:00:00 2001 From: Bob Clary Date: Sun, 14 Dec 2014 18:18:39 -0800 Subject: [PATCH] Bug 1110817 - [mozdevice] - adb_android.is_device_ready - UnboundLocalError: local variable 'data' referenced before assignment, r=wlach. --- testing/mozbase/mozdevice/mozdevice/adb_android.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/testing/mozbase/mozdevice/mozdevice/adb_android.py b/testing/mozbase/mozdevice/mozdevice/adb_android.py index 09cff13012c2..c519299aad62 100644 --- a/testing/mozbase/mozdevice/mozdevice/adb_android.py +++ b/testing/mozbase/mozdevice/mozdevice/adb_android.py @@ -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