summaryrefslogtreecommitdiff
path: root/test/TAR
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2017-03-12 23:33:00 -0400
committerWilliam Deegan <bill@baddogconsulting.com>2017-03-12 23:33:00 -0400
commite54039fdd8675b7147293d5c1233e9c8982673a1 (patch)
tree6b6a57d75f4be82a5864af9fe11af51bd0769b7e /test/TAR
parente9697930e73c81fcad8f937a99a3d4aab766a28e (diff)
downloadscons-e54039fdd8675b7147293d5c1233e9c8982673a1.tar.gz
py2/3 byte fixes
Diffstat (limited to 'test/TAR')
-rw-r--r--test/TAR/TAR.py14
-rw-r--r--test/TAR/TARFLAGS.py14
2 files changed, 10 insertions, 18 deletions
diff --git a/test/TAR/TAR.py b/test/TAR/TAR.py
index 8aa2747b..65e6182f 100644
--- a/test/TAR/TAR.py
+++ b/test/TAR/TAR.py
@@ -44,15 +44,11 @@ for opt, arg in opts:
if opt == '-f': out = arg
def process(outfile, name):
if os.path.isdir(name):
- ## TODO 2.4: the next three lines can be replaced by
- #for entry in sorted(os.listdir(name)):
- list = os.listdir(name)
- list.sort()
- for entry in list:
+ for entry in sorted(os.listdir(name)):
process(outfile, os.path.join(name, entry))
else:
- outfile.write(open(name, 'rb').read())
-outfile = open(out, 'wb')
+ outfile.write(open(name, 'r').read())
+outfile = open(out, 'w')
for infile in args:
process(outfile, infile)
outfile.close()
@@ -77,11 +73,11 @@ test.write(['sub1', 'file6'], "sub1/file6\n")
test.run(arguments = 'aaa.tar', stderr = None)
-test.fail_test(test.read('aaa.tar') != "file1\nfile2\nfile3\n")
+test.must_match('aaa.tar', "file1\nfile2\nfile3\n", mode='r')
test.run(arguments = 'bbb.tar', stderr = None)
-test.fail_test(test.read('bbb.tar') != "sub1/file5\nsub1/file6\nfile4\n")
+test.must_match('bbb.tar', "sub1/file5\nsub1/file6\nfile4\n", mode='r')
tar = test.detect('TAR', 'tar')
diff --git a/test/TAR/TARFLAGS.py b/test/TAR/TARFLAGS.py
index 034539c2..e1eae0f4 100644
--- a/test/TAR/TARFLAGS.py
+++ b/test/TAR/TARFLAGS.py
@@ -46,15 +46,11 @@ for opt, arg in cmd_opts:
else: opt_string = opt_string + ' ' + opt
def process(outfile, name):
if os.path.isdir(name):
- ## TODO 2.5: the next three lines can be replaced by
- #for entry in sorted(os.listdir(name)):
- entries = os.listdir(name)
- entries.sort()
- for entry in entries:
+ for entry in sorted(os.listdir(name)):
process(outfile, os.path.join(name, entry))
else:
- outfile.write(open(name, 'rb').read())
-outfile = open(out, 'wb')
+ outfile.write(open(name, 'r').read())
+outfile = open(out, 'w')
outfile.write('options: %s\\n' % opt_string)
for infile in args:
process(outfile, infile)
@@ -82,11 +78,11 @@ test.write(['sub1', 'file6'], "sub1/file6\n")
test.run(arguments = 'aaa.tar', stderr = None)
-test.fail_test(test.read('aaa.tar') != "options: -x\nfile1\nfile2\nfile3\n")
+test.must_match('aaa.tar', "options: -x\nfile1\nfile2\nfile3\n", mode='r')
test.run(arguments = 'bbb.tar', stderr = None)
-test.fail_test(test.read('bbb.tar') != "options: -x\nsub1/file5\nsub1/file6\nfile4\n")
+test.must_match('bbb.tar', "options: -x\nsub1/file5\nsub1/file6\nfile4\n", mode='r')