Bug 1650915 - [mozdevice] Do no type conversion on file contents returned by get_file; r=bc
authorGeoff Brown <gbrown@mozilla.com>
Fri, 07 Aug 2020 22:45:28 +0000
changeset 543852 7c01df7faa16f189e8b8e58f4fd5b26eaa99f37b
parent 543851 0564d60f6ed01f42e849a0b3c9114b9ffddfeef1
child 543853 0fa4371f24bf9108eba4ddd4ca0815a4b668b217
push id37682
push userccoroiu@mozilla.com
push dateSat, 08 Aug 2020 09:35:45 +0000
treeherdermozilla-central@fa0dbdf15f29 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbc
bugs1650915
milestone81.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1650915 - [mozdevice] Do no type conversion on file contents returned by get_file; r=bc Make the caller responsible for any desired type conversion, so that binary data can be retrieved. This just works in py2. 'mach gtest' is the only py3 caller, and it already calls ensure_str on the returned file contents. mochitest/reftest (via remoteautomation.py) may require additional consideration when they are converted to py3 (coming soon!?). Differential Revision: https://phabricator.services.mozilla.com/D86437
testing/mozbase/mozdevice/mozdevice/adb.py
--- a/testing/mozbase/mozdevice/mozdevice/adb.py
+++ b/testing/mozbase/mozdevice/mozdevice/adb.py
@@ -2670,21 +2670,21 @@ class ADBDevice(ADBCommand):
 
         with tempfile.NamedTemporaryFile() as tf:
             self.pull(remote, tf.name, timeout=timeout)
             with io.open(tf.name, mode='rb') as tf2:
                 # ADB pull does not support offset and length, but we can
                 # instead read only the requested portion of the local file
                 if offset is not None and length is not None:
                     tf2.seek(offset)
-                    return six.ensure_str(tf2.read(length))
+                    return tf2.read(length)
                 if offset is not None:
                     tf2.seek(offset)
-                    return six.ensure_str(tf2.read())
-                return six.ensure_str(tf2.read())
+                    return tf2.read()
+                return tf2.read()
 
     def rm(self, path, recursive=False, force=False, timeout=None):
         """Delete files or directories on the device.
 
         :param str path: The path of the remote file or directory.
         :param bool recursive: Flag specifying if the command is
             to be applied recursively to the target. Default is False.
         :param bool force: Flag which if True will not raise an