NativeHeapDumpViewer: Python 3 compatibility

Fix some minor compat issues. Also clean up file close.

Test: native_heapdump_viewer_tests
Change-Id: Ic43b5cc61f26dd11fffe4e9b7a06056e4ed1c676
This commit is contained in:
Andreas Gampe
2018-10-29 13:25:49 -07:00
parent 9240b454cc
commit 547631e12a
2 changed files with 73 additions and 70 deletions

View File

@@ -27,7 +27,7 @@ class NativeHeapdumpViewerTest(unittest.TestCase):
def CreateTmpFile(self, contents):
fd, self._tmp_file_name = tempfile.mkstemp()
os.write(fd, contents)
os.write(fd, contents.encode())
os.close(fd)
return self._tmp_file_name
@@ -36,7 +36,7 @@ class NativeHeapdumpViewerTest(unittest.TestCase):
try:
os.unlink(self._tmp_file_name)
except Exception:
print "Failed to delete " + heap
print("Failed to delete %s" % (heap))
class GetNumFieldValidTest(NativeHeapdumpViewerTest):
_map_data = """