D5655: tests: use bytes for file I/O

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Wed Jan 23 00:50:31 EST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGabac73eedd4d: tests: use bytes for file I/O (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5655?vs=13351&id=13367

REVISION DETAIL
  https://phab.mercurial-scm.org/D5655

AFFECTED FILES
  tests/test-remotefilelog-histpack.py

CHANGE DETAILS

diff --git a/tests/test-remotefilelog-histpack.py b/tests/test-remotefilelog-histpack.py
--- a/tests/test-remotefilelog-histpack.py
+++ b/tests/test-remotefilelog-histpack.py
@@ -232,12 +232,12 @@
 
     def testBadVersionThrows(self):
         pack = self.createPack()
-        path = pack.path + '.histpack'
-        with open(path) as f:
+        path = pack.path + b'.histpack'
+        with open(path, 'rb') as f:
             raw = f.read()
         raw = struct.pack('!B', 255) + raw[1:]
         os.chmod(path, os.stat(path).st_mode | stat.S_IWRITE)
-        with open(path, 'w+') as f:
+        with open(path, 'wb+') as f:
             f.write(raw)
 
         try:



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list