summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2017-03-20 16:50:54 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2017-03-20 16:50:54 (GMT)
commit18e4b000061b0cc22d5fbb44df4e68e740d7afb8 (patch)
tree9160b9feb418baa302cf5c9ed590cf1a66d36f2f
parent2ce34914cff387ad0db3e8d3dd4347a79a058640 (diff)
downloadSCons-18e4b000061b0cc22d5fbb44df4e68e740d7afb8.zip
SCons-18e4b000061b0cc22d5fbb44df4e68e740d7afb8.tar.gz
SCons-18e4b000061b0cc22d5fbb44df4e68e740d7afb8.tar.bz2
py2/3 fix win32 py27 failures. Also resolve some py3 failures
-rw-r--r--test/DVIPDF/DVIPDF.py4
-rw-r--r--test/DVIPS/DVIPS.py10
-rw-r--r--test/Repository/variants.py134
-rw-r--r--test/SConscript/SConscriptChdir.py8
-rw-r--r--test/Scanner/dictionary.py12
-rw-r--r--test/Scanner/multi-env.py8
-rw-r--r--test/Scanner/source_scanner-dict.py20
-rw-r--r--test/Scanner/unicode.py21
-rw-r--r--test/TEX/LATEX.py16
-rw-r--r--test/TEX/TEXFLAGS.py2
-rw-r--r--test/explain/basic.py40
-rw-r--r--test/explain/save-info.py18
-rw-r--r--test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py33
13 files changed, 180 insertions, 146 deletions
diff --git a/test/DVIPDF/DVIPDF.py b/test/DVIPDF/DVIPDF.py
index b60107d..87f4012 100644
--- a/test/DVIPDF/DVIPDF.py
+++ b/test/DVIPDF/DVIPDF.py
@@ -96,9 +96,9 @@ test.write('test2.tex', r"""This is a .tex test.
test.run(arguments = '.', stderr = None)
-test.must_match('test1.pdf', "This is a .dvi test.\n")
+test.must_match('test1.pdf', "This is a .dvi test.\n", mode='r')
-test.must_match('test2.pdf', "This is a .tex test.\n")
+test.must_match('test2.pdf', "This is a .tex test.\n", mode='r')
diff --git a/test/DVIPS/DVIPS.py b/test/DVIPS/DVIPS.py
index 01f0078..27e89ba 100644
--- a/test/DVIPS/DVIPS.py
+++ b/test/DVIPS/DVIPS.py
@@ -105,13 +105,13 @@ test.write('test4.latex', r"""This is a .latex test.
test.run(arguments = '.', stderr = None)
-test.must_match('test1.ps', "This is a .dvi test.\n")
+test.must_match('test1.ps', "This is a .dvi test.\n", mode='r')
-test.must_match('test2.ps', "This is a .tex test.\n")
+test.must_match('test2.ps', "This is a .tex test.\n", mode='r')
-test.must_match('test3.ps', "This is a .ltx test.\n")
+test.must_match('test3.ps', "This is a .ltx test.\n", mode='r')
-test.must_match('test4.ps', "This is a .latex test.\n")
+test.must_match('test4.ps', "This is a .latex test.\n", mode='r')
have_latex = test.where_is('latex')
@@ -172,7 +172,7 @@ dvips -o bar2.ps bar2.dvi
dvips -o bar3.ps bar3.dvi
"""
- test.must_match('wrapper.out', expect)
+ test.must_match('wrapper.out', expect, mode='r')
test.must_exist(test.workpath('bar1.ps'))
test.must_exist(test.workpath('bar2.ps'))
diff --git a/test/Repository/variants.py b/test/Repository/variants.py
index e8c07a7..f6b53eb 100644
--- a/test/Repository/variants.py
+++ b/test/Repository/variants.py
@@ -215,33 +215,37 @@ main(int argc, char *argv[])
""")
#
-test.run(chdir = 'repository', options = opts + " OS=foo", arguments = '.')
+test.run(chdir='repository', options=opts + " OS=foo", arguments='.')
-test.run(program = repository_build1_foo_xxx, stdout = """\
+test.run(program=repository_build1_foo_xxx, stdout="""\
repository/src1/aaa.c: REPOSITORY_FOO
repository/src1/bbb.c: REPOSITORY_FOO
repository/src1/main.c: REPOSITORY_FOO
""")
-test.fail_test(os.path.exists(test.workpath('repository', 'src1', '.sconsign')))
-test.fail_test(os.path.exists(test.workpath('repository', 'src2', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src1', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src2', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work1', 'src1', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work2', 'src2', '.sconsign')))
-test.run(program = repository_build2_foo_src2_xxx_xxx, stdout = """\
+test.run(program=repository_build2_foo_src2_xxx_xxx, stdout="""\
repository/src2/include/my_string.h: FOO
repository/src2/xxx/include.h: FOO
repository/src2/xxx/main.c: FOO
""")
-test.run(program = repository_build2_bar_src2_xxx_xxx, stdout = """\
+test.run(program=repository_build2_bar_src2_xxx_xxx, stdout="""\
repository/src2/include/my_string.h: BAR
repository/src2/xxx/include.h: BAR
repository/src2/xxx/main.c: BAR
""")
-test.fail_test(os.path.exists(test.workpath('repository', 'src1', '.sconsign')))
-test.fail_test(os.path.exists(test.workpath('repository', 'src2', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src1', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src2', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work1', 'src1', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work2', 'src2', '.sconsign')))
@@ -250,30 +254,36 @@ test.fail_test(os.path.exists(test.workpath('work2', 'src2', '.sconsign')))
test.writable('repository', 0)
#
-test.up_to_date(chdir = 'work1', options = opts + " OS=foo", arguments = 'build1')
+test.up_to_date(chdir='work1', options=opts + " OS=foo", arguments='build1')
-test.fail_test(os.path.exists(test.workpath('work1', 'build1', 'foo', aaa_obj)))
-test.fail_test(os.path.exists(test.workpath('work1', 'build1', 'foo', bbb_obj)))
-test.fail_test(os.path.exists(test.workpath('work1', 'build1', 'foo', main_obj)))
+test.fail_test(os.path.exists(
+ test.workpath('work1', 'build1', 'foo', aaa_obj)))
+test.fail_test(os.path.exists(
+ test.workpath('work1', 'build1', 'foo', bbb_obj)))
+test.fail_test(os.path.exists(test.workpath(
+ 'work1', 'build1', 'foo', main_obj)))
-test.fail_test(os.path.exists(test.workpath('work1', 'build1', 'foo', xxx_exe)))
+test.fail_test(os.path.exists(
+ test.workpath('work1', 'build1', 'foo', xxx_exe)))
#
-test.run(chdir = 'work1', options = opts, arguments = 'OS=bar .')
+test.run(chdir='work1', options=opts, arguments='OS=bar .')
-test.run(program = work1_build1_bar_xxx, stdout = """\
+test.run(program=work1_build1_bar_xxx, stdout="""\
Only when -DBAR.
repository/src1/aaa.c: REPOSITORY_BAR
repository/src1/bbb.c: REPOSITORY_BAR
repository/src1/main.c: REPOSITORY_BAR
""")
-test.fail_test(os.path.exists(test.workpath('repository', 'src1', '.sconsign')))
-test.fail_test(os.path.exists(test.workpath('repository', 'src2', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src1', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src2', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work1', 'src1', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work2', 'src2', '.sconsign')))
-test.up_to_date(chdir = 'work1', options = opts + " OS=bar", arguments = 'build1')
+test.up_to_date(chdir='work1', options=opts + " OS=bar", arguments='build1')
# Ensure file time stamps will be newer.
time.sleep(2)
@@ -288,49 +298,61 @@ test.write(['work1', 'src1', 'iii.h'], r"""
""")
#
-test.run(chdir = 'work1', options = opts + " OS=bar", arguments = 'build1')
+test.run(chdir='work1', options=opts + " OS=bar", arguments='build1')
-test.run(program = work1_build1_bar_xxx, stdout = """\
+test.run(program=work1_build1_bar_xxx, stdout="""\
Only when -DBAR.
repository/src1/aaa.c: WORK_BAR
repository/src1/bbb.c: WORK_BAR
repository/src1/main.c: WORK_BAR
""")
-test.fail_test(os.path.exists(test.workpath('repository', 'src1', '.sconsign')))
-test.fail_test(os.path.exists(test.workpath('repository', 'src2', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src1', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src2', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work1', 'src1', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work2', 'src2', '.sconsign')))
-test.up_to_date(chdir = 'work1', options = opts + " OS=bar", arguments = 'build1')
+test.up_to_date(chdir='work1', options=opts + " OS=bar", arguments='build1')
#
-test.run(chdir = 'work1', options = opts + " OS=foo", arguments = 'build1')
+test.run(chdir='work1', options=opts + " OS=foo", arguments='build1')
-test.run(program = work1_build1_foo_xxx, stdout = """\
+test.run(program=work1_build1_foo_xxx, stdout="""\
repository/src1/aaa.c: WORK_FOO
repository/src1/bbb.c: WORK_FOO
repository/src1/main.c: WORK_FOO
""")
-test.fail_test(os.path.exists(test.workpath('repository', 'src1', '.sconsign')))
-test.fail_test(os.path.exists(test.workpath('repository', 'src2', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src1', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src2', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work1', 'src1', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work2', 'src2', '.sconsign')))
-test.up_to_date(chdir = 'work1', options = opts + " OS=foo", arguments = 'build1')
+test.up_to_date(chdir='work1', options=opts + " OS=foo", arguments='build1')
#
-test.up_to_date(chdir = 'work2', options = opts, arguments = 'build2')
-
-test.fail_test(os.path.exists(test.workpath('work2', 'build2', 'foo', 'src2', 'xxx', aaa_obj)))
-test.fail_test(os.path.exists(test.workpath('work2', 'build2', 'foo', 'src2', 'xxx', bbb_obj)))
-test.fail_test(os.path.exists(test.workpath('work2', 'build2', 'foo', 'src2', 'xxx', main_obj)))
-test.fail_test(os.path.exists(test.workpath('work2', 'build2', 'foo', 'src2', 'xxx', xxx_exe)))
-test.fail_test(os.path.exists(test.workpath('work2', 'build2', 'bar', 'src2', 'xxx', aaa_obj)))
-test.fail_test(os.path.exists(test.workpath('work2', 'build2', 'bar', 'src2', 'xxx', bbb_obj)))
-test.fail_test(os.path.exists(test.workpath('work2', 'build2', 'bar', 'src2', 'xxx', main_obj)))
-test.fail_test(os.path.exists(test.workpath('work2', 'build2', 'bar', 'src2', 'xxx', xxx_exe)))
+test.up_to_date(chdir='work2', options=opts, arguments='build2')
+
+test.fail_test(os.path.exists(test.workpath(
+ 'work2', 'build2', 'foo', 'src2', 'xxx', aaa_obj)))
+test.fail_test(os.path.exists(test.workpath(
+ 'work2', 'build2', 'foo', 'src2', 'xxx', bbb_obj)))
+test.fail_test(os.path.exists(test.workpath(
+ 'work2', 'build2', 'foo', 'src2', 'xxx', main_obj)))
+test.fail_test(os.path.exists(test.workpath(
+ 'work2', 'build2', 'foo', 'src2', 'xxx', xxx_exe)))
+test.fail_test(os.path.exists(test.workpath(
+ 'work2', 'build2', 'bar', 'src2', 'xxx', aaa_obj)))
+test.fail_test(os.path.exists(test.workpath(
+ 'work2', 'build2', 'bar', 'src2', 'xxx', bbb_obj)))
+test.fail_test(os.path.exists(test.workpath(
+ 'work2', 'build2', 'bar', 'src2', 'xxx', main_obj)))
+test.fail_test(os.path.exists(test.workpath(
+ 'work2', 'build2', 'bar', 'src2', 'xxx', xxx_exe)))
# Ensure file time stamps will be newer.
time.sleep(2)
@@ -346,22 +368,24 @@ test.write(['work2', 'src2', 'include', 'my_string.h'], r"""
""")
#
-test.run(chdir = 'work2', options = opts, arguments = 'build2')
+test.run(chdir='work2', options=opts, arguments='build2')
-test.run(program = work2_build2_foo_src2_xxx_xxx, stdout = """\
+test.run(program=work2_build2_foo_src2_xxx_xxx, stdout="""\
work2/src2/include/my_string.h: FOO
repository/src2/xxx/include.h: FOO
repository/src2/xxx/main.c: FOO
""")
-test.run(program = work2_build2_bar_src2_xxx_xxx, stdout = """\
+test.run(program=work2_build2_bar_src2_xxx_xxx, stdout="""\
work2/src2/include/my_string.h: BAR
repository/src2/xxx/include.h: BAR
repository/src2/xxx/main.c: BAR
""")
-test.fail_test(os.path.exists(test.workpath('repository', 'src1', '.sconsign')))
-test.fail_test(os.path.exists(test.workpath('repository', 'src2', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src1', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src2', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work1', 'src1', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work2', 'src2', '.sconsign')))
@@ -379,44 +403,48 @@ test.write(['work2', 'src2', 'xxx', 'include.h'], r"""
#define XXX_STRING "work2/src2/xxx/include.h: %s\n"
""")
-test.run(chdir = 'work2', options = opts, arguments = 'build2')
+test.run(chdir='work2', options=opts, arguments='build2')
-test.run(program = work2_build2_foo_src2_xxx_xxx, stdout = """\
+test.run(program=work2_build2_foo_src2_xxx_xxx, stdout="""\
work2/src2/include/my_string.h: FOO
work2/src2/xxx/include.h: FOO
repository/src2/xxx/main.c: FOO
""")
-test.run(program = work2_build2_bar_src2_xxx_xxx, stdout = """\
+test.run(program=work2_build2_bar_src2_xxx_xxx, stdout="""\
work2/src2/include/my_string.h: BAR
work2/src2/xxx/include.h: BAR
repository/src2/xxx/main.c: BAR
""")
-test.fail_test(os.path.exists(test.workpath('repository', 'src1', '.sconsign')))
-test.fail_test(os.path.exists(test.workpath('repository', 'src2', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src1', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src2', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work1', 'src1', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work2', 'src2', '.sconsign')))
#
test.unlink(['work2', 'src2', 'include', 'my_string.h'])
-test.run(chdir = 'work2', options = opts, arguments = 'build2')
+test.run(chdir='work2', options=opts, arguments='build2')
-test.run(program = work2_build2_foo_src2_xxx_xxx, stdout = """\
+test.run(program=work2_build2_foo_src2_xxx_xxx, stdout="""\
repository/src2/include/my_string.h: FOO
work2/src2/xxx/include.h: FOO
repository/src2/xxx/main.c: FOO
""")
-test.run(program = work2_build2_bar_src2_xxx_xxx, stdout = """\
+test.run(program=work2_build2_bar_src2_xxx_xxx, stdout="""\
repository/src2/include/my_string.h: BAR
work2/src2/xxx/include.h: BAR
repository/src2/xxx/main.c: BAR
""")
-test.fail_test(os.path.exists(test.workpath('repository', 'src1', '.sconsign')))
-test.fail_test(os.path.exists(test.workpath('repository', 'src2', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src1', '.sconsign')))
+test.fail_test(os.path.exists(
+ test.workpath('repository', 'src2', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work1', 'src1', '.sconsign')))
test.fail_test(os.path.exists(test.workpath('work2', 'src2', '.sconsign')))
diff --git a/test/SConscript/SConscriptChdir.py b/test/SConscript/SConscriptChdir.py
index 2e25acf..6cd4566 100644
--- a/test/SConscript/SConscriptChdir.py
+++ b/test/SConscript/SConscriptChdir.py
@@ -76,10 +76,10 @@ f.close()
test.run(arguments=".", stderr=None)
-test.must_match(['dir1', 'test.txt'],"This is the dir1 test.\n")
-test.must_match(['dir2', 'test.txt'], "This is the dir2 test.\n")
-test.must_match('test.txt',"This is the dir3 test.\nThis is the dir5 test.\n")
-test.must_match(['dir4', 'test.txt'],"This is the dir4 test.\n")
+test.must_match(['dir1', 'test.txt'],"This is the dir1 test.\n", mode='r')
+test.must_match(['dir2', 'test.txt'], "This is the dir2 test.\n", mode='r')
+test.must_match('test.txt',"This is the dir3 test.\nThis is the dir5 test.\n", mode='r')
+test.must_match(['dir4', 'test.txt'],"This is the dir4 test.\n", mode='r')
test.pass_test()
diff --git a/test/Scanner/dictionary.py b/test/Scanner/dictionary.py
index f6f121e..c587098 100644
--- a/test/Scanner/dictionary.py
+++ b/test/Scanner/dictionary.py
@@ -146,9 +146,9 @@ expect_aaa = 'aaa.k1 1\nline 2\nxxx 1\ninclude2 yyy\ninclude3 zzz\nline 6\n'
expect_bbb = 'bbb.k2 1\nline 2\ninclude1 xxx\nyyy 1\ninclude3 zzz\nline 6\n'
expect_ccc = 'ccc.k3 1\nline 2\ninclude1 xxx\ninclude2 yyy\nzzz 1\nline 6\n'
-test.must_match('aaa', expect_aaa)
-test.must_match('bbb', expect_bbb)
-test.must_match('ccc', expect_ccc)
+test.must_match('aaa', expect_aaa, mode='r')
+test.must_match('bbb', expect_bbb, mode='r')
+test.must_match('ccc', expect_ccc, mode='r')
test.up_to_date(arguments = '.')
@@ -164,7 +164,7 @@ test.run(stdout=expect)
expect_ccc = 'ccc.k3 1\nline 2\ninclude1 xxx\ninclude2 yyy\nzzz 2\nline 6\n'
-test.must_match('bbb', expect_bbb)
+test.must_match('bbb', expect_bbb, mode='r')
@@ -178,7 +178,7 @@ test.run(stdout=expect)
expect_bbb = 'bbb.k2 1\nline 2\ninclude1 xxx\nyyy 2\ninclude3 zzz\nline 6\n'
-test.must_match('bbb', expect_bbb)
+test.must_match('bbb', expect_bbb, mode='r')
@@ -192,7 +192,7 @@ test.run(stdout=expect)
expect_aaa = 'aaa.k1 1\nline 2\nxxx 2\ninclude2 yyy\ninclude3 zzz\nline 6\n'
-test.must_match('bbb', expect_bbb)
+test.must_match('bbb', expect_bbb, mode='r')
diff --git a/test/Scanner/multi-env.py b/test/Scanner/multi-env.py
index 7cb052a..9cf86dc 100644
--- a/test/Scanner/multi-env.py
+++ b/test/Scanner/multi-env.py
@@ -99,8 +99,8 @@ expect = test.wrap_stdout("""\
test.run(arguments='.', stdout=expect)
-test.must_match('frog.1', 'croak\ninput sound2\n')
-test.must_match('frog.2', 'include sound1\nribbet\n')
+test.must_match('frog.1', 'croak\ninput sound2\n', mode='r')
+test.must_match('frog.2', 'include sound1\nribbet\n', mode='r')
test.write('sound2', 'rudeep\n')
@@ -110,8 +110,8 @@ expect = test.wrap_stdout("""\
test.run(arguments='.', stdout=expect)
-test.must_match('frog.1', 'croak\ninput sound2\n')
-test.must_match('frog.2', 'include sound1\nrudeep\n')
+test.must_match('frog.1', 'croak\ninput sound2\n', mode='r')
+test.must_match('frog.2', 'include sound1\nrudeep\n', mode='r')
test.pass_test()
diff --git a/test/Scanner/source_scanner-dict.py b/test/Scanner/source_scanner-dict.py
index bb12364..47773b8 100644
--- a/test/Scanner/source_scanner-dict.py
+++ b/test/Scanner/source_scanner-dict.py
@@ -155,10 +155,10 @@ expect_bbb = 'bbb.k2 1\nline 2\ninclude1 xxx\nyyy 1\ninclude3 zzz\nline 6\n'
expect_ccc = 'ccc.k3 1\nline 2\ninclude1 xxx\ninclude2 yyy\nzzz 1\nline 6\n'
expect_ddd = 'ddd.k4 1\nline 2\nline 3\n' + expect_aaa + expect_bbb + expect_ccc
-test.must_match('aaa', expect_aaa)
-test.must_match('bbb', expect_bbb)
-test.must_match('ccc', expect_ccc)
-test.must_match('ddd', expect_ddd)
+test.must_match('aaa', expect_aaa, mode='r')
+test.must_match('bbb', expect_bbb, mode='r')
+test.must_match('ccc', expect_ccc, mode='r')
+test.must_match('ddd', expect_ddd, mode='r')
test.up_to_date(arguments = '.')
@@ -176,8 +176,8 @@ test.run(stdout=expect)
expect_ccc = 'ccc.k3 1\nline 2\ninclude1 xxx\ninclude2 yyy\nzzz 2\nline 6\n'
expect_ddd = 'ddd.k4 1\nline 2\nline 3\n' + expect_aaa + expect_bbb + expect_ccc
-test.must_match('bbb', expect_bbb)
-test.must_match('ddd', expect_ddd)
+test.must_match('bbb', expect_bbb, mode='r')
+test.must_match('ddd', expect_ddd, mode='r')
@@ -193,8 +193,8 @@ test.run(stdout=expect)
expect_bbb = 'bbb.k2 1\nline 2\ninclude1 xxx\nyyy 2\ninclude3 zzz\nline 6\n'
expect_ddd = 'ddd.k4 1\nline 2\nline 3\n' + expect_aaa + expect_bbb + expect_ccc
-test.must_match('bbb', expect_bbb)
-test.must_match('ddd', expect_ddd)
+test.must_match('bbb', expect_bbb, mode='r')
+test.must_match('ddd', expect_ddd, mode='r')
@@ -210,8 +210,8 @@ test.run(stdout=expect)
expect_aaa = 'aaa.k1 1\nline 2\nxxx 2\ninclude2 yyy\ninclude3 zzz\nline 6\n'
expect_ddd = 'ddd.k4 1\nline 2\nline 3\n' + expect_aaa + expect_bbb + expect_ccc
-test.must_match('aaa', expect_aaa)
-test.must_match('ddd', expect_ddd)
+test.must_match('aaa', expect_aaa, mode='r')
+test.must_match('ddd', expect_ddd, mode='r')
diff --git a/test/Scanner/unicode.py b/test/Scanner/unicode.py
index c698532..96010de 100644
--- a/test/Scanner/unicode.py
+++ b/test/Scanner/unicode.py
@@ -50,14 +50,17 @@ import sys
def process(outfp, infile):
contents = open(infile, 'rb').read()
- if contents.startswith(codecs.BOM_UTF8):
+ if contents[:len(codecs.BOM_UTF8)] == codecs.BOM_UTF8:
contents = contents[len(codecs.BOM_UTF8):].decode('utf-8')
- elif contents.startswith(codecs.BOM_UTF16_LE):
+ elif contents[:len(codecs.BOM_UTF16_LE)] == codecs.BOM_UTF16_LE:
contents = contents[len(codecs.BOM_UTF16_LE):].decode('utf-16-le')
- elif contents.startswith(codecs.BOM_UTF16_BE):
+ elif contents[:len(codecs.BOM_UTF16_BE)] == codecs.BOM_UTF16_BE:
contents = contents[len(codecs.BOM_UTF16_BE):].decode('utf-16-be')
- else:
+ try:
contents = contents.decode('ascii')
+ except (UnicodeDecodeError, AttributeError) as e:
+ contents = contents
+
for line in contents.split('\n')[:-1]:
if line[:8] == 'include ':
process(outfp, line[8:])
@@ -156,7 +159,7 @@ utf16be.k 1 line 3
foo.k 1 line 4
"""
-test.must_match('foo', expect)
+test.must_match('foo', expect, mode='r')
test.up_to_date(arguments='foo')
@@ -183,7 +186,7 @@ utf16be.k 1 line 3
foo.k 1 line 4
"""
-test.must_match('foo', expect)
+test.must_match('foo', expect, mode='r')
test.up_to_date(arguments = 'foo')
@@ -210,7 +213,7 @@ utf16be.k 1 line 3
foo.k 1 line 4
"""
-test.must_match('foo', expect)
+test.must_match('foo', expect, mode='r')
test.up_to_date(arguments = 'foo')
@@ -237,7 +240,7 @@ utf16be.k 1 line 3
foo.k 1 line 4
"""
-test.must_match('foo', expect)
+test.must_match('foo', expect, mode='r')
test.up_to_date(arguments = 'foo')
@@ -264,7 +267,7 @@ utf16be.k 1 line 3
foo.k 1 line 4
"""
-test.must_match('foo', expect)
+test.must_match('foo', expect, mode='r')
test.up_to_date(arguments = 'foo')
diff --git a/test/TEX/LATEX.py b/test/TEX/LATEX.py
index 362bb62..dc5e535 100644
--- a/test/TEX/LATEX.py
+++ b/test/TEX/LATEX.py
@@ -72,13 +72,13 @@ test.write('test2.latex', r"""This is a .latex test.
test.run(arguments = '.')
-test.must_match('test1.dvi', "This is a .ltx test.\n")
-test.must_match('test1.aux', "This is a .ltx test.\n")
-test.must_match('test1.log', "This is a .ltx test.\n")
+test.must_match('test1.dvi', "This is a .ltx test.\n", mode='r')
+test.must_match('test1.aux', "This is a .ltx test.\n", mode='r')
+test.must_match('test1.log', "This is a .ltx test.\n", mode='r')
-test.must_match('test2.dvi', "This is a .latex test.\n")
-test.must_match('test2.aux', "This is a .latex test.\n")
-test.must_match('test2.log', "This is a .latex test.\n")
+test.must_match('test2.dvi', "This is a .latex test.\n", mode='r')
+test.must_match('test2.aux', "This is a .latex test.\n", mode='r')
+test.must_match('test2.log', "This is a .latex test.\n", mode='r')
test.run(arguments = '-c .')
@@ -174,11 +174,11 @@ This is the include file. mod %s
test.must_exist('foo.dvi')
test.run(arguments = 'bar.dvi', stderr = None)
- test.must_match('wrapper.out', "wrapper.py\n")
+ test.must_match('wrapper.out', "wrapper.py\n", mode='r')
test.must_exist('bar.dvi')
test.run(arguments = 'makeindex.dvi', stderr = None)
- test.must_match('wrapper.out', "wrapper.py\n")
+ test.must_match('wrapper.out', "wrapper.py\n", mode='r')
test.run(arguments = 'latexi.dvi', stderr = None)
test.must_exist('latexi.dvi')
diff --git a/test/TEX/TEXFLAGS.py b/test/TEX/TEXFLAGS.py
index 4b632f7..7b4fd15 100644
--- a/test/TEX/TEXFLAGS.py
+++ b/test/TEX/TEXFLAGS.py
@@ -65,7 +65,7 @@ test.write('test.tex', r"""This is a test.
test.run(arguments = 'test.dvi', stderr = None)
-test.must_match('test.dvi'," -x\nThis is a test.\n")
+test.must_match('test.dvi'," -x\nThis is a test.\n", mode='r')
diff --git a/test/explain/basic.py b/test/explain/basic.py
index fb331fe..ec7238e 100644
--- a/test/explain/basic.py
+++ b/test/explain/basic.py
@@ -207,15 +207,15 @@ test.set_match_function(TestSCons.match_caseinsensitive)
test.run(chdir='src', arguments=args, stdout=expect)
test.set_match_function(TestSCons.match_exact)
-test.must_match(['src', 'file1'], "file1.in 1\n")
+test.must_match(['src', 'file1'], "file1.in 1\n", mode='r')
test.must_match(['src', 'file2'], """\
file2.k 1 line 1
xxx 1
yyy 1
file2.k 1 line 4
-""")
-test.must_match(['src', 'file3'], "xxx 1\nyyy 1\nzzz 1\n")
-test.must_match(['src', 'file4'], "file4.in 1\n")
+""", mode='r')
+test.must_match(['src', 'file3'], "xxx 1\nyyy 1\nzzz 1\n", mode='r')
+test.must_match(['src', 'file4'], "file4.in 1\n", mode='r')
test.must_match(['src', 'file5'], """\
file5.k 1 line 1
aaa 1
@@ -224,8 +224,8 @@ ccc 1
ddd 1
eee.in 1
file5.k 1 line 4
-""")
-test.must_match(['src', 'file6'], "file6.in 1\n")
+""", mode='r')
+test.must_match(['src', 'file6'], "file6.in 1\n", mode='r')
@@ -262,21 +262,21 @@ test.set_match_function(TestSCons.match_caseinsensitive)
test.run(chdir='src', arguments=args, stdout=expect)
test.set_match_function(TestSCons.match_exact)
-test.must_match(['src', 'file1'], "file1.in 2\n")
+test.must_match(['src', 'file1'], "file1.in 2\n", mode='r')
test.must_match(['src', 'file2'], """\
file2.k 1 line 1
xxx 1
yyy 2
file2.k 1 line 4
-""")
-test.must_match(['src', 'file3'], "xxx 1\nyyy 2\nzzz 2\n")
+""", mode='r')
+test.must_match(['src', 'file3'], "xxx 1\nyyy 2\nzzz 2\n", mode='r')
test.must_match(['src', 'file5'], """\
file5.k 1 line 1
aaa 1
bbb.k 2
ccc 1
file5.k 1 line 4
-""")
+""", mode='r')
@@ -294,7 +294,7 @@ test.set_match_function(TestSCons.match_caseinsensitive)
test.run(chdir='src', arguments=args, stdout=expect)
test.set_match_function(TestSCons.match_exact)
-test.must_match(['src', 'file3'], "xxx 1\nyyy 2\n")
+test.must_match(['src', 'file3'], "xxx 1\nyyy 2\n", mode='r')
@@ -312,7 +312,7 @@ test.set_match_function(TestSCons.match_caseinsensitive)
test.run(chdir='src', arguments=args, stdout=expect)
test.set_match_function(TestSCons.match_exact)
-test.must_match(['src', 'file3'], "xxx 1\nyyy 2\nzzz 2\n")
+test.must_match(['src', 'file3'], "xxx 1\nyyy 2\nzzz 2\n", mode='r')
@@ -334,7 +334,7 @@ test.set_match_function(TestSCons.match_caseinsensitive)
test.run(chdir='src', arguments=args, stdout=expect)
test.set_match_function(TestSCons.match_exact)
-test.must_match(['src', 'file3'], "zzz 2\nyyy 2\nxxx 1\n")
+test.must_match(['src', 'file3'], "zzz 2\nyyy 2\nxxx 1\n", mode='r')
@@ -361,9 +361,9 @@ test.set_match_function(TestSCons.match_caseinsensitive)
test.run(chdir='src', arguments=args, stdout=expect)
test.set_match_function(TestSCons.match_exact)
-test.must_match(['src', 'file3'], "zzz 2\nyyy 2\nxxx 1\n")
-test.must_match(['src', 'file3.alt'], "zzz 2\nyyy 2\nxxx 1\n")
-test.must_match(['src', 'file3.yyy'], "zzz 2\nyyy 2\nxxx 1\nyyy 2\n")
+test.must_match(['src', 'file3'], "zzz 2\nyyy 2\nxxx 1\n", mode='r')
+test.must_match(['src', 'file3.alt'], "zzz 2\nyyy 2\nxxx 1\n", mode='r')
+test.must_match(['src', 'file3.yyy'], "zzz 2\nyyy 2\nxxx 1\nyyy 2\n", mode='r')
@@ -392,9 +392,9 @@ test.set_match_function(TestSCons.match_caseinsensitive)
test.run(chdir='src', arguments=args, stdout=expect)
test.set_match_function(TestSCons.match_exact)
-test.must_match(['src', 'file3'], "zzz 2\nyyy 2\nxxx 1\n")
-test.must_match(['src', 'file3.alt'], "zzz 2\nyyy 2\nxxx 1\n")
-test.must_match(['src', 'file3.yyy'], "zzz 2\nyyy 2\nxxx 1\nxxx 1\n")
+test.must_match(['src', 'file3'], "zzz 2\nyyy 2\nxxx 1\n", mode='r')
+test.must_match(['src', 'file3.alt'], "zzz 2\nyyy 2\nxxx 1\n", mode='r')
+test.must_match(['src', 'file3.yyy'], "zzz 2\nyyy 2\nxxx 1\nxxx 1\n", mode='r')
@@ -415,7 +415,7 @@ test.set_match_function(TestSCons.match_caseinsensitive)
test.run(chdir='src',arguments=args, stdout=expect)
test.set_match_function(TestSCons.match_exact)
-test.must_match(['src', 'file4'], "file4.in 1\n")
+test.must_match(['src', 'file4'], "file4.in 1\n", mode='r')
test.up_to_date(chdir='src',arguments='.')
diff --git a/test/explain/save-info.py b/test/explain/save-info.py
index 150d7ef..048ee8d 100644
--- a/test/explain/save-info.py
+++ b/test/explain/save-info.py
@@ -145,15 +145,15 @@ test.write(['src', 'subdir', 'file6.in'], "subdir/file6.in 1\n")
#
test.run(chdir='src', arguments='..')
-test.must_match(['src', 'file1'], "file1.in 1\n")
+test.must_match(['src', 'file1'], "file1.in 1\n", mode='r')
test.must_match(['src', 'file2'], """\
file2.k 1 line 1
xxx 1
yyy 1
file2.k 1 line 4
-""")
-test.must_match(['src', 'file3'], "xxx 1\nyyy 1\nzzz 1\n")
-test.must_match(['src', 'file4'], "file4.in 1\n")
+""", mode='r')
+test.must_match(['src', 'file3'], "xxx 1\nyyy 1\nzzz 1\n", mode='r')
+test.must_match(['src', 'file4'], "file4.in 1\n", mode='r')
test.must_match(['src', 'file5'], """\
file5.k 1 line 1
aaa 1
@@ -162,7 +162,7 @@ ccc 1
ddd 1
eee.in 1
file5.k 1 line 4
-""")
+""", mode='r')
test.write(['src', 'file1.in'], "file1.in 2\n")
test.write(['src', 'yyy'], "yyy 2\n")
@@ -186,21 +186,21 @@ scons: rebuilding `file5' because `%(inc_bbb_k)s' changed
test.run(chdir='src', arguments='--debug=explain .', stdout=expect)
-test.must_match(['src', 'file1'], "file1.in 2\n")
+test.must_match(['src', 'file1'], "file1.in 2\n", mode='r')
test.must_match(['src', 'file2'], """\
file2.k 1 line 1
xxx 1
yyy 2
file2.k 1 line 4
-""")
-test.must_match(['src', 'file3'], "xxx 1\nyyy 2\nzzz 2\n")
+""", mode='r')
+test.must_match(['src', 'file3'], "xxx 1\nyyy 2\nzzz 2\n", mode='r')
test.must_match(['src', 'file5'], """\
file5.k 1 line 1
aaa 1
bbb.k 2
ccc 1
file5.k 1 line 4
-""")
+""", mode='r')
diff --git a/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py b/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py
index e2e4866..2c9fd08 100644
--- a/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py
+++ b/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py
@@ -32,7 +32,10 @@ is added to targets.
import TestSCons
-python = TestSCons.python
+# swap slashes because on py3 on win32 inside the generated build.py
+# the backslashes are getting interpretted as unicode which is
+# invalid.
+python = TestSCons.python.replace('\\','//')
_python_ = TestSCons._python_
test = TestSCons.TestSCons()
@@ -98,13 +101,13 @@ test.run(arguments = '--tree=all .')
expect_none = 'build.py %s file.in\nfile.in\n'
-test.must_match('file.out', expect_none % 'file.out')
-test.must_match('file0.out', expect_none % 'file0.out')
-test.must_match('file1.out', expect_none % 'file1.out')
-test.must_match('fileNone.out', expect_none % 'fileNone.out')
-test.must_match('fileFalse.out', expect_none % 'fileFalse.out')
-test.must_match('fileTrue.out', expect_none % 'fileTrue.out')
-test.must_match('fileQuote.out', expect_none % 'fileQuote.out')
+test.must_match('file.out', expect_none % 'file.out', mode='r')
+test.must_match('file0.out', expect_none % 'file0.out', mode='r')
+test.must_match('file1.out', expect_none % 'file1.out', mode='r')
+test.must_match('fileNone.out', expect_none % 'fileNone.out', mode='r')
+test.must_match('fileFalse.out', expect_none % 'fileFalse.out', mode='r')
+test.must_match('fileTrue.out', expect_none % 'fileTrue.out', mode='r')
+test.must_match('fileQuote.out', expect_none % 'fileQuote.out', mode='r')
@@ -115,13 +118,13 @@ test.run(arguments = '--tree=all .')
expect_extra = 'build.py %s file.in\nxyzzy\nfile.in\n'
-test.must_match('file.out', expect_extra % 'file.out')
-test.must_match('file0.out', expect_none % 'file0.out')
-test.must_match('file1.out', expect_extra % 'file1.out')
-test.must_match('fileNone.out', expect_none % 'fileNone.out')
-test.must_match('fileFalse.out', expect_none % 'fileFalse.out')
-test.must_match('fileTrue.out', expect_extra % 'fileTrue.out')
-test.must_match('fileQuote.out', expect_extra % 'fileQuote.out')
+test.must_match('file.out', expect_extra % 'file.out', mode='r')
+test.must_match('file0.out', expect_none % 'file0.out', mode='r')
+test.must_match('file1.out', expect_extra % 'file1.out', mode='r')
+test.must_match('fileNone.out', expect_none % 'fileNone.out', mode='r')
+test.must_match('fileFalse.out', expect_none % 'fileFalse.out', mode='r')
+test.must_match('fileTrue.out', expect_extra % 'fileTrue.out', mode='r')
+test.must_match('fileQuote.out', expect_extra % 'fileQuote.out', mode='r')
test.pass_test()