diff options
author | William Deegan <bill@baddogconsulting.com> | 2017-03-20 23:14:51 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2017-03-20 23:14:51 (GMT) |
commit | 43464c5aafe4cbeb950dfda6c7ec33d472a6149a (patch) | |
tree | 57d0c12603806e1a283e2e898f7fc32053e42d45 /test | |
parent | 001262877b19faabc0ad0f45d4abd1d8cfc38093 (diff) | |
download | SCons-43464c5aafe4cbeb950dfda6c7ec33d472a6149a.zip SCons-43464c5aafe4cbeb950dfda6c7ec33d472a6149a.tar.gz SCons-43464c5aafe4cbeb950dfda6c7ec33d472a6149a.tar.bz2 |
py2/3 to fix this test required several files/compares to be binary.
Diffstat (limited to 'test')
-rw-r--r-- | test/redirection.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/test/redirection.py b/test/redirection.py index 98bfc04..cc8ebf9 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() |