# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2018-02-11 11:44:59 # Node ID 035af48b290366bc76ec67fef8bed4912def364f # Parent c4fa47f880d33f62ec2570f0d13357cfb94635dc py3: replace file() with open() in test-encoding.t file() is not present in Python 3. This also makes sure we write things in bytes mode in Python 3. Differential Revision: https://phab.mercurial-scm.org/D2130 diff --git a/tests/test-encoding.t b/tests/test-encoding.t --- a/tests/test-encoding.t +++ b/tests/test-encoding.t @@ -15,9 +15,9 @@ we need a repo with some legacy latin-1 $ hg co 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ $PYTHON << EOF - > f = file('latin-1', 'w'); f.write("latin-1 e' encoded: \xe9"); f.close() - > f = file('utf-8', 'w'); f.write("utf-8 e' encoded: \xc3\xa9"); f.close() - > f = file('latin-1-tag', 'w'); f.write("\xe9"); f.close() + > f = open('latin-1', 'wb'); f.write(b"latin-1 e' encoded: \xe9"); f.close() + > f = open('utf-8', 'wb'); f.write(b"utf-8 e' encoded: \xc3\xa9"); f.close() + > f = open('latin-1-tag', 'wb'); f.write(b"\xe9"); f.close() > EOF should fail with encoding error