Commit 7b4ff457 authored by Pulkit Goyal's avatar Pulkit Goyal

py3: fix .write() calls in few tests

This patch adds b'' prefixes to make sure we write bytes and add `and None` in
the end to suppress the output by .write() calls.

Differential Revision: https://phab.mercurial-scm.org/D3610
parent e887381e2976
......@@ -68,7 +68,7 @@ Check that commit -i works with no changes
Committing only one file
$ echo "a" >> a
>>> open('b', 'wb').write("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n")
>>> open('b', 'wb').write(b"1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n") and None
$ hg add b
$ cat <<EOF >testModeCommands
> TOGGLE
......
......@@ -122,7 +122,7 @@ Create a non-inlined filelog in r3:
$ cd r3/d1
>>> f = open('data1', 'wb')
>>> for x in range(10000):
... f.write("%s\n" % str(x))
... f.write(b"%d\n" % x) and None
>>> f.close()
$ for j in 0 1 2 3 4 5 6 7 8 9; do
> cat data1 >> f2
......
......@@ -143,7 +143,7 @@ Test that --exact on a bad header doesn't corrupt the repo (issue3616)
$ hg export 2 | head -7 > ../a.patch
$ hg export tip > out
>>> apatch = open("../a.patch", "ab")
>>> apatch.write("".join(open("out").readlines()[7:]))
>>> apatch.write(b"".join(open("out", 'rb').readlines()[7:])) and None
$ cd ..
$ hg clone -qr0 repo3 repo3-clone
......
......@@ -22,16 +22,16 @@ Revert interactive tests
$ mkdir -p a/folder1 a/folder2
$ cd a
$ hg init
>>> open('f', 'wb').write("1\n2\n3\n4\n5\n")
>>> open('f', 'wb').write(b"1\n2\n3\n4\n5\n") and None
$ hg add f ; hg commit -m "adding f"
$ cat f > folder1/g ; hg add folder1/g ; hg commit -m "adding folder1/g"
$ cat f > folder2/h ; hg add folder2/h ; hg commit -m "adding folder2/h"
$ cat f > folder1/i ; hg add folder1/i ; hg commit -m "adding folder1/i"
>>> open('f', 'wb').write("a\n1\n2\n3\n4\n5\nb\n")
>>> open('f', 'wb').write(b"a\n1\n2\n3\n4\n5\nb\n") and None
$ hg commit -m "modifying f"
>>> open('folder1/g', 'wb').write("c\n1\n2\n3\n4\n5\nd\n")
>>> open('folder1/g', 'wb').write(b"c\n1\n2\n3\n4\n5\nd\n") and None
$ hg commit -m "modifying folder1/g"
>>> open('folder2/h', 'wb').write("e\n1\n2\n3\n4\n5\nf\n")
>>> open('folder2/h', 'wb').write(b"e\n1\n2\n3\n4\n5\nf\n") and None
$ hg commit -m "modifying folder2/h"
$ hg tip
changeset: 6:59dd6e4ab63a
......@@ -182,7 +182,7 @@ Test --no-backup
$ ls folder1/
g
>>> open('folder1/g', 'wb').write("1\n2\n3\n4\n5\nd\n")
>>> open('folder1/g', 'wb').write(b"1\n2\n3\n4\n5\nd\n") and None
$ hg update -C 6
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment