tests: open file in binary mode to use POSIX end-of-line style anywhere stable
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Mon, 20 Oct 2014 22:08:08 +0900
branchstable
changeset 23060 4eaea93b3e5b
parent 23059 6ecd1ff8c42c
child 23061 f2aeff8a87b6
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.
tests/test-context.py
--- a/tests/test-context.py	Mon Oct 20 22:08:08 2014 +0900
+++ b/tests/test-context.py	Mon Oct 20 22:08:08 2014 +0900
@@ -7,7 +7,7 @@
 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))