[PATCH 10 of 11 STABLE] tests: open file in binary mode to use POSIX end-of-line style anywhere

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Mon Oct 20 08:27:04 CDT 2014


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1413810488 -32400
#      Mon Oct 20 22:08:08 2014 +0900
# Branch stable
# Node ID 65e4e7f34d673b2236058ef9de57ca035a331413
# Parent  0d35f78a9e27433ad6204fe3088d6c400c1d8b89
tests: open file in binary mode to use POSIX end-of-line style anywhere

Before this patch, "test-context.py" fails on Windows environment,
because "diff" output contains unexpected "\r" character.

Opening the target file in text mode causes this automatic end-of-line
conversion.

diff --git a/tests/test-context.py b/tests/test-context.py
--- a/tests/test-context.py
+++ b/tests/test-context.py
@@ -7,7 +7,7 @@ repo = hg.repository(u, 'test1', create=
 os.chdir('test1')
 
 # create 'foo' with fixed time stamp
-f = open('foo', 'w')
+f = open('foo', 'wb')
 f.write('foo\n')
 f.close()
 os.utime('foo', (1000, 1000))


More information about the Mercurial-devel mailing list