tests: make test-dispatch.py python3 compatible

Summary: Writing to a file opened in "b" mode needs byte strings.

Reviewed By: sfilipco

Differential Revision: D19668666

fbshipit-source-id: 9e8670fa080cc2a7fc611083a4ee2305d8262a3a
This commit is contained in:
Xavier Deguillard 2020-01-31 15:28:49 -08:00 committed by Facebook Github Bot
parent 4604332170
commit 179aa8ac28

View File

@ -3,10 +3,6 @@ from __future__ import absolute_import, print_function
import os
from edenscm.mercurial import dispatch
from hghave import require
require(["py2"])
def testdispatch(cmd):
@ -25,14 +21,14 @@ os.chdir("test1")
# create file 'foo', add and commit
f = open("foo", "wb")
f.write("foo\n")
f.write(b"foo\n")
f.close()
testdispatch("add foo")
testdispatch("commit -m commit1 -d 2000-01-01 foo")
# append to file 'foo' and commit
f = open("foo", "ab")
f.write("bar\n")
f.write(b"bar\n")
f.close()
testdispatch("commit -m commit2 -d 2000-01-02 foo")