Fix Python3 str handling error. (#555)
diff --git a/mobly/controllers/android_device_lib/services/logcat.py b/mobly/controllers/android_device_lib/services/logcat.py
index c673193..b5730f0 100644
--- a/mobly/controllers/android_device_lib/services/logcat.py
+++ b/mobly/controllers/android_device_lib/services/logcat.py
@@ -124,7 +124,7 @@
except adb.AdbError as e:
# On Android O, the clear command fails due to a known bug.
# Catching this so we don't crash from this Android issue.
- if "failed to clear" in e.stderr:
+ if b'failed to clear' in e.stderr:
self._ad.log.warning(
'Encountered known Android error to clear logcat.')
else:
diff --git a/tests/mobly/controllers/android_device_lib/services/logcat_test.py b/tests/mobly/controllers/android_device_lib/services/logcat_test.py
index 4bd0f4c..10e6cf3 100755
--- a/tests/mobly/controllers/android_device_lib/services/logcat_test.py
+++ b/tests/mobly/controllers/android_device_lib/services/logcat_test.py
@@ -465,8 +465,8 @@
ad.adb.logcat = mock.MagicMock()
ad.adb.logcat.side_effect = adb.AdbError(
cmd='cmd',
- stdout='',
- stderr='failed to clear "main" log',
+ stdout=b'',
+ stderr=b'failed to clear "main" log',
ret_code=1)
logcat_service = logcat.Logcat(ad)
logcat_service.clear_adb_log()