diff options
author | William Deegan <bill@baddogconsulting.com> | 2017-03-13 03:33:00 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2017-03-13 03:33:00 (GMT) |
commit | 57f2bc39219ec1fdb609bb979294487512407963 (patch) | |
tree | 6b6a57d75f4be82a5864af9fe11af51bd0769b7e /test/TAR | |
parent | 25335d29099874e0574a79d9a8644d66f1533838 (diff) | |
download | SCons-57f2bc39219ec1fdb609bb979294487512407963.zip SCons-57f2bc39219ec1fdb609bb979294487512407963.tar.gz SCons-57f2bc39219ec1fdb609bb979294487512407963.tar.bz2 |
py2/3 byte fixes
Diffstat (limited to 'test/TAR')
-rw-r--r-- | test/TAR/TAR.py | 14 | ||||
-rw-r--r-- | test/TAR/TARFLAGS.py | 14 |
2 files changed, 10 insertions, 18 deletions
diff --git a/test/TAR/TAR.py b/test/TAR/TAR.py index 8aa2747..65e6182 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 034539c..e1eae0f 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') |