summaryrefslogtreecommitdiff
path: root/test/redirection.py
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2017-03-20 16:14:51 -0700
committerWilliam Deegan <bill@baddogconsulting.com>2017-03-20 16:14:51 -0700
commit0680a973048a464fb6c2a23475ad3be66f21822d (patch)
tree57d0c12603806e1a283e2e898f7fc32053e42d45 /test/redirection.py
parent64d22ea84a817ad89c8758afa1100ad489377933 (diff)
downloadscons-0680a973048a464fb6c2a23475ad3be66f21822d.tar.gz
py2/3 to fix this test required several files/compares to be binary.
Diffstat (limited to 'test/redirection.py')
-rw-r--r--test/redirection.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/test/redirection.py b/test/redirection.py
index 98bfc04d..cc8ebf92 100644
--- a/test/redirection.py
+++ b/test/redirection.py
@@ -33,10 +33,15 @@ test = TestSCons.TestSCons()
test.write('cat.py', r"""
import sys
try:
- input = open(sys.argv[1], 'r').read()
+ input = open(sys.argv[1], 'rb').read()
+ try:
+ sys.stdout.buffer.write(input)
+ except AttributeError:
+ sys.stdout.write(input)
except IndexError:
input = sys.stdin.read()
-sys.stdout.write(input)
+ sys.stdout.write(input)
+
sys.exit(0)
""")
@@ -52,17 +57,17 @@ env.Command(target='foo4', source='bar4',
action=r'%(_python_)s cat.py <$SOURCES |%(_python_)s cat.py >$TARGET')
""" % locals())
-test.write('bar1', 'bar1\r\n')
-test.write('bar2', 'bar2\r\n')
-test.write('bar3', 'bar3\r\n')
-test.write('bar4', 'bar4\r\n')
+test.write('bar1', 'bar1\r\n', mode='w')
+test.write('bar2', 'bar2\r\n', mode='w')
+test.write('bar3', 'bar3\r\n', mode='w')
+test.write('bar4', 'bar4\r\n', mode='w')
test.run(arguments='.')
-test.fail_test(test.read('foo1') != 'bar1\r\n')
-test.fail_test(test.read('foo2') != 'bar2\r\n')
-test.fail_test(test.read('foo3') != 'bar3\r\n')
-test.fail_test(test.read('foo4') != 'bar4\r\n')
+test.must_match('foo1', 'bar1\r\n')
+test.must_match('foo2', 'bar2\r\n')
+test.must_match('foo3', 'bar3\r\n')
+test.must_match('foo4', 'bar4\r\n')
test.pass_test()