changeset 15522:cf0f3cb8a332

tests: don't use stdout redirection for test data Stdout redirection is not binary safe everywhere - for example not on windows with msys.
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 16 Nov 2011 03:45:14 +0100
parents 117f9190c1ba
children e7119b091809
files tests/test-clone.t tests/test-diff-newlines.t tests/test-import.t
diffstat 3 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-clone.t	Wed Nov 16 03:45:14 2011 +0100
+++ b/tests/test-clone.t	Wed Nov 16 03:45:14 2011 +0100
@@ -10,7 +10,7 @@
 
 Create a non-inlined filelog:
 
-  $ python -c 'for x in range(10000): print x' >> data1
+  $ python -c 'file("data1", "wb").write("".join("%s\n" % x for x in range(10000)))'
   $ for j in 0 1 2 3 4 5 6 7 8 9; do
   >   cat data1 >> b
   >   hg commit -m test
--- a/tests/test-diff-newlines.t	Wed Nov 16 03:45:14 2011 +0100
+++ b/tests/test-diff-newlines.t	Wed Nov 16 03:45:14 2011 +0100
@@ -1,6 +1,6 @@
   $ hg init
 
-  $ python -c 'print "confuse str.splitlines\nembedded\rnewline"' > a
+  $ python -c 'file("a", "wb").write("confuse str.splitlines\nembedded\rnewline\n")'
   $ hg ci -Ama -d '1 0'
   adding a
 
--- a/tests/test-import.t	Wed Nov 16 03:45:14 2011 +0100
+++ b/tests/test-import.t	Wed Nov 16 03:45:14 2011 +0100
@@ -233,7 +233,7 @@
   > msg.set_payload('email commit message\n' + patch)
   > msg['Subject'] = 'email patch'
   > msg['From'] = 'email patcher'
-  > sys.stdout.write(msg.as_string())
+  > file(sys.argv[2], 'wb').write(msg.as_string())
   > EOF
 
 
@@ -246,7 +246,7 @@
   added 1 changesets with 2 changes to 2 files
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ python mkmsg.py diffed-tip.patch > msg.patch
+  $ python mkmsg.py diffed-tip.patch msg.patch
   $ hg --cwd b import ../msg.patch
   applying ../msg.patch
   $ hg --cwd b tip | grep email
@@ -308,7 +308,8 @@
   added 1 changesets with 2 changes to 2 files
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ python mkmsg.py exported-tip.patch | hg --cwd b import -
+  $ python mkmsg.py exported-tip.patch msg.patch
+  $ cat msg.patch | hg --cwd b import -
   applying patch from stdin
   $ hg --cwd b tip | grep second
   summary:     second change
@@ -325,7 +326,7 @@
   > msg.set_payload('email patch\n\nnext line\n---\n' + patch)
   > msg['Subject'] = '[PATCH] email patch'
   > msg['From'] = 'email patcher'
-  > sys.stdout.write(msg.as_string())
+  > file(sys.argv[2], 'wb').write(msg.as_string())
   > EOF
 
 
@@ -338,7 +339,8 @@
   added 1 changesets with 2 changes to 2 files
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ python mkmsg2.py diffed-tip.patch | hg --cwd b import -
+  $ python mkmsg2.py diffed-tip.patch msg.patch
+  $ cat msg.patch | hg --cwd b import -
   applying patch from stdin
   $ hg --cwd b tip --template '{desc}\n'
   email patch