From bb8e7208ea54b023c9b47aa02c304adfab9bf90e Mon Sep 17 00:00:00 2001 From: Raphael Pierzina Date: Tue, 3 Jul 2018 10:09:41 +0200 Subject: [PATCH] Bug 1471622 - Fix mozfile's test_tempfile.py under Python 3.5; r=davehunt MozReview-Commit-ID: JuWRTVEFJtv --HG-- extra : rebase_source : 11393471d8d199623d2150071fa75e1e5a26504f --- testing/mozbase/mozfile/tests/manifest.ini | 1 - testing/mozbase/mozfile/tests/test_tempfile.py | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/testing/mozbase/mozfile/tests/manifest.ini b/testing/mozbase/mozfile/tests/manifest.ini index 747b8e5a1b1d..2f65b62e69c4 100644 --- a/testing/mozbase/mozfile/tests/manifest.ini +++ b/testing/mozbase/mozfile/tests/manifest.ini @@ -7,6 +7,5 @@ skip-if = python == 3 skip-if = python == 3 [test_tempdir.py] [test_tempfile.py] -skip-if = python == 3 [test_tree.py] [test_url.py] diff --git a/testing/mozbase/mozfile/tests/test_tempfile.py b/testing/mozbase/mozfile/tests/test_tempfile.py index 2658053a594d..94c186744753 100644 --- a/testing/mozbase/mozfile/tests/test_tempfile.py +++ b/testing/mozbase/mozfile/tests/test_tempfile.py @@ -35,21 +35,21 @@ class TestNamedTemporaryFile(unittest.TestCase): temp.flush() # Test we can open the file again on all platforms - self.assertEqual(open(temp.name).read(), test_string) + self.assertEqual(open(temp.name, 'rb').read(), test_string) def test_iteration(self): """ensure the line iterator works""" # make a file and write to it tf = mozfile.NamedTemporaryFile() - notes = ['doe', 'rae', 'mi'] + notes = [b'doe', b'rae', b'mi'] for note in notes: tf.write(b'%s\n' % note) tf.flush() # now read from it tf.seek(0) - lines = [line.rstrip('\n') for line in tf.readlines()] + lines = [line.rstrip(b'\n') for line in tf.readlines()] self.assertEqual(lines, notes) # now read from it iteratively