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/Repository | |
parent | 25335d29099874e0574a79d9a8644d66f1533838 (diff) | |
download | SCons-57f2bc39219ec1fdb609bb979294487512407963.zip SCons-57f2bc39219ec1fdb609bb979294487512407963.tar.gz SCons-57f2bc39219ec1fdb609bb979294487512407963.tar.bz2 |
py2/3 byte fixes
Diffstat (limited to 'test/Repository')
-rw-r--r-- | test/Repository/Default.py | 14 | ||||
-rw-r--r-- | test/Repository/Install.py | 2 | ||||
-rw-r--r-- | test/Repository/InstallAs.py | 6 | ||||
-rw-r--r-- | test/Repository/LIBPATH.py | 14 | ||||
-rw-r--r-- | test/Repository/Local.py | 16 | ||||
-rw-r--r-- | test/Repository/SConscript.py | 12 | ||||
-rw-r--r-- | test/Repository/VariantDir.py | 28 | ||||
-rw-r--r-- | test/Repository/option-c.py | 66 | ||||
-rw-r--r-- | test/Repository/option-f.py | 10 | ||||
-rw-r--r-- | test/Repository/option-n.py | 6 | ||||
-rw-r--r-- | test/Repository/targets.py | 14 |
11 files changed, 92 insertions, 96 deletions
diff --git a/test/Repository/Default.py b/test/Repository/Default.py index 44aecfb..bd9d5f8 100644 --- a/test/Repository/Default.py +++ b/test/Repository/Default.py @@ -47,7 +47,7 @@ def copy(env, source, target): source = str(source[0]) target = str(target[0]) print('copy() < %s > %s' % (source, target)) - open(target, "wb").write(open(source, "rb").read()) + open(target, "w").write(open(source, "r").read()) Build = Builder(action=copy) env = Environment(BUILDERS={'Build':Build}) @@ -80,19 +80,19 @@ test.writable('repository', 0) test.run(chdir = 'work', options = opts, arguments = '') test.fail_test(os.path.exists(work_aaa_out)) -test.fail_test(test.read(work_bbb_out) != "repository/bbb.in\n") +test.must_match(work_bbb_out, "repository/bbb.in\n", mode='r') test.fail_test(os.path.exists(work_ccc_out)) test.fail_test(os.path.exists(work_subdir_ddd_out)) -test.fail_test(test.read(work_subdir_eee_out) != "repository/subdir/eee.in\n") +test.must_match(work_subdir_eee_out, "repository/subdir/eee.in\n", mode='r') test.fail_test(os.path.exists(work_subdir_fff_out)) # test.run(chdir = 'work', options = opts, arguments = '.') -test.fail_test(test.read(work_aaa_out) != "repository/aaa.in\n") -test.fail_test(test.read(work_ccc_out) != "repository/ccc.in\n") -test.fail_test(test.read(work_subdir_ddd_out) != "repository/subdir/ddd.in\n") -test.fail_test(test.read(work_subdir_fff_out) != "repository/subdir/fff.in\n") +test.must_match(work_aaa_out, "repository/aaa.in\n", mode='r') +test.must_match(work_ccc_out, "repository/ccc.in\n", mode='r') +test.must_match(work_subdir_ddd_out, "repository/subdir/ddd.in\n", mode='r') +test.must_match(work_subdir_fff_out, "repository/subdir/fff.in\n", mode='r') test.up_to_date(chdir = 'work', options = opts, arguments = '.') diff --git a/test/Repository/Install.py b/test/Repository/Install.py index 5e64d55..75052e7 100644 --- a/test/Repository/Install.py +++ b/test/Repository/Install.py @@ -51,7 +51,7 @@ test.writable('repository', 0) test.run(chdir = 'work', options = opts, arguments = install) -test.fail_test(test.read(install_file) != "repository/file\n") +test.must_match(install_file, "repository/file\n", mode='r') test.up_to_date(chdir = 'work', options = opts, arguments = install) diff --git a/test/Repository/InstallAs.py b/test/Repository/InstallAs.py index 0923d88..d717254 100644 --- a/test/Repository/InstallAs.py +++ b/test/Repository/InstallAs.py @@ -56,9 +56,9 @@ test.writable('repository', 0) test.run(chdir = 'work', options = opts, arguments = install) -test.fail_test(test.read(install_file1_out) != "repository/file1.in\n") -test.fail_test(test.read(install_file2_out) != "repository/file2.in\n") -test.fail_test(test.read(install_file3_out) != "repository/file3.in\n") +test.must_match(install_file1_out, "repository/file1.in\n", mode='r') +test.must_match(install_file2_out, "repository/file2.in\n", mode='r') +test.must_match(install_file3_out, "repository/file3.in\n", mode='r') test.up_to_date(chdir = 'work', options = opts, arguments = install) diff --git a/test/Repository/LIBPATH.py b/test/Repository/LIBPATH.py index c95d29a..8b396fa 100644 --- a/test/Repository/LIBPATH.py +++ b/test/Repository/LIBPATH.py @@ -46,7 +46,7 @@ bbb_exe = env_yyy.Program('bbb', 'bbb.c') def write_LIBDIRFLAGS(env, target, source): pre = env.subst('$LIBDIRPREFIX') suf = env.subst('$LIBDIRSUFFIX') - f = open(str(target[0]), 'wb') + f = open(str(target[0]), 'w') for arg in env.subst('$_LIBDIRFLAGS', target=target).split(): if arg[:len(pre)] == pre: arg = arg[len(pre):] @@ -97,14 +97,12 @@ test.run(chdir = 'work', options = opts, arguments = ".") #dirs = ['.', workpath_foo, workpath_bar, workpath_foo_zzz] dirs = ['.', workpath_foo, workpath_bar, 'zzz', workpath_foo_zzz, workpath_bar_zzz] -test.fail_test(test.read(['work', 'zzz.out']) != - '\n'.join(dirs) + '\n') +test.must_match(['work', 'zzz.out'],'\n'.join(dirs) + '\n', mode='r') #dirs = [workpath_bar_yyy, '.', workpath_foo, workpath_bar] dirs = ['yyy', workpath_foo_yyy, workpath_bar_yyy, '.', workpath_foo, workpath_bar] -test.fail_test(test.read(['work', 'yyy.out']) != - '\n'.join(dirs) + '\n') +test.must_match(['work', 'yyy.out'], '\n'.join(dirs) + '\n', mode='r') # test.run(chdir = 'work', options = '-c', arguments = ".") @@ -117,14 +115,12 @@ test.run(chdir = 'work', options = opts, arguments = ".") #dirs = ['.', workpath_foo, workpath_bar, 'zzz', workpath_foo_zzz] dirs = ['.', workpath_foo, workpath_bar, 'zzz', workpath_foo_zzz, workpath_bar_zzz] -test.fail_test(test.read(['work', 'zzz.out']) != - '\n'.join(dirs) + '\n') +test.must_match(['work', 'zzz.out'], '\n'.join(dirs) + '\n', mode='r') #dirs = ['yyy', workpath_bar_yyy, '.', workpath_foo, workpath_bar] dirs = ['yyy', workpath_foo_yyy, workpath_bar_yyy, '.', workpath_foo, workpath_bar] -test.fail_test(test.read(['work', 'yyy.out']) != - '\n'.join(dirs) + '\n') +test.must_match(['work', 'yyy.out'], '\n'.join(dirs) + '\n', mode='r') # test.pass_test() diff --git a/test/Repository/Local.py b/test/Repository/Local.py index ea03281..95fd898 100644 --- a/test/Repository/Local.py +++ b/test/Repository/Local.py @@ -49,7 +49,7 @@ def copy(env, source, target): source = str(source[0]) target = str(target[0]) print('copy() < %s > %s' % (source, target)) - open(target, "wb").write(open(source, "rb").read()) + open(target, "w").write(open(source, "r").read()) Build = Builder(action=copy) env = Environment(BUILDERS={'Build':Build}, BBB='bbb') @@ -66,7 +66,7 @@ test.write(['repository', 'src', 'SConscript'], r""" def bbb_copy(env, source, target): target = str(target[0]) print('bbb_copy()') - open(target, "wb").write(open('build/bbb.1', "rb").read()) + open(target, "w").write(open('build/bbb.1', "r").read()) Import("env") env.Build('bbb.1', 'bbb.0') @@ -82,8 +82,8 @@ test.write(['repository', 'src', 'bbb.x'], "repository/src/bbb.x\n") # test.run(chdir = 'repository', options = opts, arguments = '.') -test.fail_test(test.read(repository_aaa_out) != "repository/aaa.in\n") -test.fail_test(test.read(repository_build_bbb_2) != "repository/src/bbb.0\n") +test.must_match(repository_aaa_out, "repository/aaa.in\n", mode='r') +test.must_match(repository_build_bbb_2, "repository/src/bbb.0\n", mode='r') test.up_to_date(chdir = 'repository', options = opts, arguments = '.') @@ -95,8 +95,8 @@ test.writable('repository', 0) test.run(chdir = 'work', options = opts, arguments = 'aaa.out build/bbb.2') test.fail_test(os.path.exists(work_aaa_mid)) -test.fail_test(test.read(work_aaa_out) != "repository/aaa.in\n") -test.fail_test(test.read(work_build_bbb_1) != "repository/src/bbb.0\n") +test.must_match(work_aaa_out, "repository/aaa.in\n", mode='r') +test.must_match(work_build_bbb_1, "repository/src/bbb.0\n", mode='r') test.fail_test(os.path.exists(work_build_bbb_2)) # @@ -105,8 +105,8 @@ test.write(['work', 'aaa.in'], "work/aaa.in\n") # test.run(chdir = 'work', options = opts, arguments = '.') -test.fail_test(test.read(work_aaa_mid) != "work/aaa.in\n") -test.fail_test(test.read(work_aaa_out) != "work/aaa.in\n") +test.must_match(work_aaa_mid, "work/aaa.in\n", mode='r') +test.must_match(work_aaa_out, "work/aaa.in\n", mode='r') test.up_to_date(chdir = 'work', options = opts, arguments = '.') diff --git a/test/Repository/SConscript.py b/test/Repository/SConscript.py index 22956ac..1b67c07 100644 --- a/test/Repository/SConscript.py +++ b/test/Repository/SConscript.py @@ -61,9 +61,9 @@ SConscript('src/SConscript') test.write(['rep1', 'src', 'SConscript'], """\ def cat(env, source, target): target = str(target[0]) - f = open(target, "wb") + f = open(target, "w") for src in source: - f.write(open(str(src), "rb").read()) + f.write(open(str(src), "r").read()) f.close() env = Environment(BUILDERS={'Cat':Builder(action=cat)}) env.Cat(target = 'foo', source = ['aaa.in', 'bbb.in', 'ccc.in']) @@ -79,11 +79,11 @@ test.writable('rep1', 0) test.run(chdir = 'work', arguments = ".") -test.fail_test(test.read(['work', 'src', 'foo']) != """\ +test.must_match(['work', 'src', 'foo'], """\ rep1/src/aaa.in rep1/src/bbb.in rep1/src/ccc.in -""") +""", mode='r') test.up_to_date(chdir = 'work', arguments = ".") @@ -115,11 +115,11 @@ test.write(['rep2', 'src', 'ccc.in'], "rep2/src/ccc.in\n") test.run(chdir = 'rep2/build', arguments = ".") -test.fail_test(test.read(['rep2', 'build', 'src', 'foo']) != """\ +test.must_match(['rep2', 'build', 'src', 'foo'], """\ rep2/src/aaa.in rep2/src/bbb.in rep2/src/ccc.in -""") +""", mode='r') # test.pass_test() diff --git a/test/Repository/VariantDir.py b/test/Repository/VariantDir.py index 0258ff5..8887f86 100644 --- a/test/Repository/VariantDir.py +++ b/test/Repository/VariantDir.py @@ -49,9 +49,9 @@ def cat(env, source, target): target = str(target[0]) source = list(map(str, source)) print('cat(%s) > %s' % (source, target)) - f = open(target, "wb") + f = open(target, "w") for src in source: - f.write(open(src, "rb").read()) + f.write(open(src, "r").read()) f.close() env = Environment(BUILDERS={'Build':Builder(action=cat)}) @@ -72,11 +72,11 @@ test.writable('repository', 0) # test.run(chdir = 'work1', options = opts, arguments = '.') -test.fail_test(test.read(['work1', 'build0', 'output']) != +test.must_match(['work1', 'build0', 'output'], """repository/src/aaa.in repository/src/bbb.in repository/src/ccc.in -""") +""", mode='r') test.fail_test(os.path.exists('work1/build0/aaa.in')) test.fail_test(os.path.exists('work1/build0/bbb.in')) @@ -85,11 +85,11 @@ test.fail_test(not os.path.exists('work1/build0/aaa.mid')) test.fail_test(not os.path.exists('work1/build0/bbb.mid')) test.fail_test(not os.path.exists('work1/build0/ccc.mid')) -test.fail_test(test.read(['work1', 'build1', 'output']) != +test.must_match(['work1', 'build1', 'output'], """repository/src/aaa.in repository/src/bbb.in repository/src/ccc.in -""") +""", mode='r') test.fail_test(not os.path.exists('work1/build1/aaa.in')) test.fail_test(not os.path.exists('work1/build1/bbb.in')) @@ -105,11 +105,11 @@ test.write(['work1', 'src', 'bbb.in'], "work1/src/bbb.in\n") test.run(chdir = 'work1', options = opts, arguments = '.') -test.fail_test(test.read(['work1', 'build0', 'output']) != +test.must_match(['work1', 'build0', 'output'], """repository/src/aaa.in work1/src/bbb.in repository/src/ccc.in -""") +""", mode='r') test.fail_test(os.path.exists('work1/build0/aaa.in')) test.fail_test(os.path.exists('work1/build0/bbb.in')) @@ -118,11 +118,11 @@ test.fail_test(not os.path.exists('work1/build0/aaa.mid')) test.fail_test(not os.path.exists('work1/build0/bbb.mid')) test.fail_test(not os.path.exists('work1/build0/ccc.mid')) -test.fail_test(test.read(['work1', 'build1', 'output']) != +test.must_match(['work1', 'build1', 'output'], """repository/src/aaa.in work1/src/bbb.in repository/src/ccc.in -""") +""", mode='r') test.fail_test(not os.path.exists('work1/build1/aaa.in')) test.fail_test(not os.path.exists('work1/build1/bbb.in')) @@ -167,11 +167,11 @@ test.write(['work2', 'src', 'bbb.in'], "work2/src/bbb.in\n") test.run(chdir = 'work2', options = opts, arguments = '.') -test.fail_test(test.read(['work2', 'build0', 'output']) != +test.must_match(['work2', 'build0', 'output'], """repository/src/aaa.in work2/src/bbb.in repository/src/ccc.in -""") +""", mode='r') test.fail_test(os.path.exists('work2/build0/aaa.in')) test.fail_test(os.path.exists('work2/build0/bbb.in')) @@ -180,11 +180,11 @@ test.fail_test(os.path.exists('work2/build0/aaa.mid')) test.fail_test(not os.path.exists('work2/build0/bbb.mid')) test.fail_test(os.path.exists('work2/build0/ccc.mid')) -test.fail_test(test.read(['work2', 'build1', 'output']) != +test.must_match(['work2', 'build1', 'output'], """repository/src/aaa.in work2/src/bbb.in repository/src/ccc.in -""") +""", mode='r') test.fail_test(not os.path.exists('work2/build1/aaa.in')) test.fail_test(not os.path.exists('work2/build1/bbb.in')) diff --git a/test/Repository/option-c.py b/test/Repository/option-c.py index c06c7d8..b0d8533 100644 --- a/test/Repository/option-c.py +++ b/test/Repository/option-c.py @@ -66,7 +66,7 @@ def copy(env, source, target): source = str(source[0]) target = str(target[0]) print('copy() < %s > %s' % (source, target)) - open(target, "wb").write(open(source, "rb").read()) + open(target, "w").write(open(source, "r").read()) Build = Builder(action=copy) env = Environment(BUILDERS={'Build':Build}) @@ -100,14 +100,14 @@ test.writable('repository', 0) # copying them from the Repository. test.run(chdir = 'work', options = opts, arguments = '.') -test.fail_test(test.read(work_aaa_mid) != "repository/aaa.in\n") -test.fail_test(test.read(work_aaa_out) != "repository/aaa.in\n") -test.fail_test(test.read(work_bbb_mid) != "repository/bbb.in\n") -test.fail_test(test.read(work_bbb_out) != "repository/bbb.in\n") -test.fail_test(test.read(work_subdir_ccc_mid) != "repository/subdir/ccc.in\n") -test.fail_test(test.read(work_subdir_ccc_out) != "repository/subdir/ccc.in\n") -test.fail_test(test.read(work_subdir_ddd_mid) != "repository/subdir/ddd.in\n") -test.fail_test(test.read(work_subdir_ddd_out) != "repository/subdir/ddd.in\n") +test.must_match(work_aaa_mid, "repository/aaa.in\n", mode='r') +test.must_match(work_aaa_out, "repository/aaa.in\n", mode='r') +test.must_match(work_bbb_mid, "repository/bbb.in\n", mode='r') +test.must_match(work_bbb_out, "repository/bbb.in\n", mode='r') +test.must_match(work_subdir_ccc_mid, "repository/subdir/ccc.in\n", mode='r') +test.must_match(work_subdir_ccc_out, "repository/subdir/ccc.in\n", mode='r') +test.must_match(work_subdir_ddd_mid, "repository/subdir/ddd.in\n", mode='r') +test.must_match(work_subdir_ddd_out, "repository/subdir/ddd.in\n", mode='r') test.up_to_date(chdir = 'work', options = opts, arguments = '.') @@ -117,14 +117,14 @@ test.writable('repository', 1) # Now build everything in the repository. test.run(chdir = 'repository', options = opts, arguments = '.') -test.fail_test(test.read(repository_aaa_mid) != "repository/aaa.in\n") -test.fail_test(test.read(repository_aaa_out) != "repository/aaa.in\n") -test.fail_test(test.read(repository_bbb_mid) != "repository/bbb.in\n") -test.fail_test(test.read(repository_bbb_out) != "repository/bbb.in\n") -test.fail_test(test.read(repository_subdir_ccc_mid) != "repository/subdir/ccc.in\n") -test.fail_test(test.read(repository_subdir_ccc_out) != "repository/subdir/ccc.in\n") -test.fail_test(test.read(repository_subdir_ddd_mid) != "repository/subdir/ddd.in\n") -test.fail_test(test.read(repository_subdir_ddd_out) != "repository/subdir/ddd.in\n") +test.must_match(repository_aaa_mid, "repository/aaa.in\n", mode='r') +test.must_match(repository_aaa_out, "repository/aaa.in\n", mode='r') +test.must_match(repository_bbb_mid, "repository/bbb.in\n", mode='r') +test.must_match(repository_bbb_out, "repository/bbb.in\n", mode='r') +test.must_match(repository_subdir_ccc_mid, "repository/subdir/ccc.in\n", mode='r') +test.must_match(repository_subdir_ccc_out, "repository/subdir/ccc.in\n", mode='r') +test.must_match(repository_subdir_ddd_mid, "repository/subdir/ddd.in\n", mode='r') +test.must_match(repository_subdir_ddd_out, "repository/subdir/ddd.in\n", mode='r') test.up_to_date(chdir = 'repository', options = opts, arguments = '.') @@ -135,20 +135,20 @@ test.writable('repository', 0) # test.run(chdir = 'work', options = opts + ' -c', arguments = 'bbb.mid bbb.out') -test.fail_test(test.read(work_aaa_mid) != "repository/aaa.in\n") -test.fail_test(test.read(work_aaa_out) != "repository/aaa.in\n") +test.must_match(work_aaa_mid, "repository/aaa.in\n", mode='r') +test.must_match(work_aaa_out, "repository/aaa.in\n", mode='r') test.fail_test(os.path.exists(work_bbb_mid)) test.fail_test(os.path.exists(work_bbb_out)) -test.fail_test(test.read(work_subdir_ccc_mid) != "repository/subdir/ccc.in\n") -test.fail_test(test.read(work_subdir_ccc_out) != "repository/subdir/ccc.in\n") -test.fail_test(test.read(work_subdir_ddd_mid) != "repository/subdir/ddd.in\n") -test.fail_test(test.read(work_subdir_ddd_out) != "repository/subdir/ddd.in\n") +test.must_match(work_subdir_ccc_mid, "repository/subdir/ccc.in\n", mode='r') +test.must_match(work_subdir_ccc_out, "repository/subdir/ccc.in\n", mode='r') +test.must_match(work_subdir_ddd_mid, "repository/subdir/ddd.in\n", mode='r') +test.must_match(work_subdir_ddd_out, "repository/subdir/ddd.in\n", mode='r') # test.run(chdir = 'work', options = opts + ' -c', arguments = 'subdir') -test.fail_test(test.read(work_aaa_mid) != "repository/aaa.in\n") -test.fail_test(test.read(work_aaa_out) != "repository/aaa.in\n") +test.must_match(work_aaa_mid, "repository/aaa.in\n", mode='r') +test.must_match(work_aaa_out, "repository/aaa.in\n", mode='r') test.fail_test(os.path.exists(work_bbb_mid)) test.fail_test(os.path.exists(work_bbb_out)) test.fail_test(os.path.exists(work_subdir_ccc_mid)) @@ -169,14 +169,14 @@ test.fail_test(os.path.exists(work_subdir_ddd_mid)) test.fail_test(os.path.exists(work_subdir_ddd_out)) # Double-check that nothing in the repository got deleted. -test.fail_test(test.read(repository_aaa_mid) != "repository/aaa.in\n") -test.fail_test(test.read(repository_aaa_out) != "repository/aaa.in\n") -test.fail_test(test.read(repository_bbb_mid) != "repository/bbb.in\n") -test.fail_test(test.read(repository_bbb_out) != "repository/bbb.in\n") -test.fail_test(test.read(repository_subdir_ccc_mid) != "repository/subdir/ccc.in\n") -test.fail_test(test.read(repository_subdir_ccc_out) != "repository/subdir/ccc.in\n") -test.fail_test(test.read(repository_subdir_ddd_mid) != "repository/subdir/ddd.in\n") -test.fail_test(test.read(repository_subdir_ddd_out) != "repository/subdir/ddd.in\n") +test.must_match(repository_aaa_mid, "repository/aaa.in\n", mode='r') +test.must_match(repository_aaa_out, "repository/aaa.in\n", mode='r') +test.must_match(repository_bbb_mid, "repository/bbb.in\n", mode='r') +test.must_match(repository_bbb_out, "repository/bbb.in\n", mode='r') +test.must_match(repository_subdir_ccc_mid, "repository/subdir/ccc.in\n", mode='r') +test.must_match(repository_subdir_ccc_out, "repository/subdir/ccc.in\n", mode='r') +test.must_match(repository_subdir_ddd_mid, "repository/subdir/ddd.in\n", mode='r') +test.must_match(repository_subdir_ddd_out, "repository/subdir/ddd.in\n", mode='r') # test.pass_test() diff --git a/test/Repository/option-f.py b/test/Repository/option-f.py index 8511f6a..c990f2f 100644 --- a/test/Repository/option-f.py +++ b/test/Repository/option-f.py @@ -76,7 +76,7 @@ test.writable('repository', 0) # test.run(chdir = 'work', options = opts, arguments = 'aaa.out') -test.fail_test(test.read(['work', 'aaa.out']) != "repository/aaa.in\n") +test.must_match(['work', 'aaa.out'], "repository/aaa.in\n", mode='r') test.fail_test(os.path.exists(test.workpath('work', 'bbb.out'))) test.fail_test(os.path.exists(test.workpath('work', 'ccc.out'))) test.fail_test(os.path.exists(test.workpath('work', 'src', 'xxx.out'))) @@ -84,15 +84,15 @@ test.fail_test(os.path.exists(test.workpath('work', 'src', 'yyy.out'))) test.run(chdir = 'work', options = opts, arguments = 'bbb.out src') -test.fail_test(test.read(['work', 'bbb.out']) != "repository/bbb.in\n") +test.must_match(['work', 'bbb.out'], "repository/bbb.in\n", mode='r') test.fail_test(os.path.exists(test.workpath('work', 'ccc.out'))) -test.fail_test(test.read(['work', 'src', 'xxx.out']) != "repository/src/xxx.in\n") -test.fail_test(test.read(['work', 'src', 'yyy.out']) != "repository/src/yyy.in\n") +test.must_match(['work', 'src', 'xxx.out'], "repository/src/xxx.in\n", mode='r') +test.must_match(['work', 'src', 'yyy.out'], "repository/src/yyy.in\n", mode='r') # test.run(chdir = 'work', options = opts, arguments = '.') -test.fail_test(test.read(['work', 'ccc.out']) != "repository/ccc.in\n") +test.must_match(['work', 'ccc.out'], "repository/ccc.in\n", mode='r') # test.pass_test() diff --git a/test/Repository/option-n.py b/test/Repository/option-n.py index 2a0ae5d..d23a200 100644 --- a/test/Repository/option-n.py +++ b/test/Repository/option-n.py @@ -49,7 +49,7 @@ def copy(env, source, target): source = str(source[0]) target = str(target[0]) print('copy() < %s > %s' % (source, target)) - open(target, "wb").write(open(source, "rb").read()) + open(target, "w").write(open(source, "r").read()) Build = Builder(action=copy) env = Environment(BUILDERS={'Build':Build}) @@ -62,7 +62,7 @@ test.write(['repository', 'aaa.in'], "repository/aaa.in\n") # test.run(chdir = 'repository', options = opts, arguments = '.') -test.fail_test(test.read(repository_aaa_out) != "repository/aaa.in\n") +test.must_match(repository_aaa_out,"repository/aaa.in\n", mode='r') test.up_to_date(chdir = 'repository', options = opts, arguments = '.') @@ -88,7 +88,7 @@ test.run(chdir = 'work', arguments = 'aaa.out', stdout = expect) -test.fail_test(test.read(work_aaa_out) != "repository/aaa.in\n") +test.must_match(work_aaa_out, "repository/aaa.in\n", mode='r') # test.pass_test() diff --git a/test/Repository/targets.py b/test/Repository/targets.py index 0fbc896..0bc625a 100644 --- a/test/Repository/targets.py +++ b/test/Repository/targets.py @@ -44,9 +44,9 @@ def cat(env, source, target): target = str(target[0]) source = list(map(str, source)) print('cat(%s) > %s' % (source, target)) - f = open(target, "wb") + f = open(target, "w") for src in source: - f.write(open(src, "rb").read()) + f.write(open(src, "r").read()) f.close() env = Environment(BUILDERS={'Build':Builder(action=cat)}) @@ -77,7 +77,7 @@ test.writable('repository', 0) # test.run(chdir = 'work', options = opts, arguments = 'aaa.out') -test.fail_test(test.read(['work', 'aaa.out']) != "repository/aaa.in\n") +test.must_match(['work', 'aaa.out'], "repository/aaa.in\n", mode='r') test.fail_test(os.path.exists(test.workpath('work', 'bbb.out'))) test.fail_test(os.path.exists(test.workpath('work', 'ccc.out'))) test.fail_test(os.path.exists(test.workpath('work', 'src', 'xxx.out'))) @@ -85,15 +85,15 @@ test.fail_test(os.path.exists(test.workpath('work', 'src', 'yyy.out'))) test.run(chdir = 'work', options = opts, arguments = 'bbb.out src') -test.fail_test(test.read(['work', 'bbb.out']) != "repository/bbb.in\n") +test.must_match(['work', 'bbb.out'], "repository/bbb.in\n", mode='r') test.fail_test(os.path.exists(test.workpath('work', 'ccc.out'))) -test.fail_test(test.read(['work', 'src', 'xxx.out']) != "repository/src/xxx.in\n") -test.fail_test(test.read(['work', 'src', 'yyy.out']) != "repository/src/yyy.in\n") +test.must_match(['work', 'src', 'xxx.out'], "repository/src/xxx.in\n", mode='r') +test.must_match(['work', 'src', 'yyy.out'], "repository/src/yyy.in\n", mode='r') # test.run(chdir = 'work', options = opts, arguments = '.') -test.fail_test(test.read(['work', 'ccc.out']) != "repository/ccc.in\n") +test.must_match(['work', 'ccc.out'], "repository/ccc.in\n", mode='r') # test.pass_test() |