diff options
author | Steven Knight <knight@baldmt.com> | 2001-09-16 04:22:19 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2001-09-16 04:22:19 (GMT) |
commit | e88681240924e70ec12abaf3664290a69db6dcfd (patch) | |
tree | 136311c7b231f8d467156a9ae4a9d53428f364fc /test | |
parent | fcd916513a1ad10e13479d4d604f239f7ea45c73 (diff) | |
download | SCons-e88681240924e70ec12abaf3664290a69db6dcfd.zip SCons-e88681240924e70ec12abaf3664290a69db6dcfd.tar.gz SCons-e88681240924e70ec12abaf3664290a69db6dcfd.tar.bz2 |
Add more information error reporting from tests.
Diffstat (limited to 'test')
44 files changed, 172 insertions, 361 deletions
diff --git a/test/Help.py b/test/Help.py index 1014f6e..69db872 100644 --- a/test/Help.py +++ b/test/Help.py @@ -12,9 +12,8 @@ test.write('SConstruct', r""" Help("Help text\ngoes here.\n") """) -test.run(arguments = '-h') +expect = "Help text\ngoes here.\n\nUse scons -H for help about command-line options.\n" -test.fail_test(test.stdout() != "Help text\ngoes here.\n\nUse scons -H for help about command-line options.\n") -test.fail_test(test.stderr() != "") +test.run(arguments = '-h', stdout = expect) test.pass_test() diff --git a/test/Program-j.py b/test/Program-j.py index 1a0e6a6..4a4fee7 100644 --- a/test/Program-j.py +++ b/test/Program-j.py @@ -54,17 +54,12 @@ main(int argc, char *argv[]) test.run(arguments = '-j 3 f1 f2 f3 f4') -test.run(program = test.workpath('f1')) -test.fail_test(test.stdout() != "f1.c\n") +test.run(program = test.workpath('f1'), stdout = "f1.c\n") -test.run(program = test.workpath('f2')) -test.fail_test(test.stdout() != "f2.c\n") +test.run(program = test.workpath('f2'), stdout = "f2.c\n") -test.run(program = test.workpath('f3')) -test.fail_test(test.stdout() != "f3.c\n") - -test.run(program = test.workpath('f4')) -test.fail_test(test.stdout() != "f4.c\n") +test.run(program = test.workpath('f3'), stdout = "f3.c\n") +test.run(program = test.workpath('f4'), stdout = "f4.c\n") test.pass_test() diff --git a/test/Program.py b/test/Program.py index 8fb0fa4..6a0a517 100644 --- a/test/Program.py +++ b/test/Program.py @@ -22,8 +22,6 @@ main(int argc, char *argv[]) test.run(arguments = 'foo') -test.run(program = test.workpath('foo')) - -test.fail_test(test.stdout() != "foo.c\n") +test.run(program = test.workpath('foo'), stdout = "foo.c\n") test.pass_test() diff --git a/test/SConscript.py b/test/SConscript.py index 10898f3..7cb55d5 100644 --- a/test/SConscript.py +++ b/test/SConscript.py @@ -20,7 +20,6 @@ print "SConscript " + os.getcwd() wpath = test.workpath() -test.run(chdir = '.') -test.fail_test(test.stdout() != ("SConstruct %s\nSConscript %s\n" % (wpath, wpath))) +test.run(stdout = "SConstruct %s\nSConscript %s\n" % (wpath, wpath)) test.pass_test() diff --git a/test/SConstruct.py b/test/SConstruct.py index aa92ffc..8b586d2 100644 --- a/test/SConstruct.py +++ b/test/SConstruct.py @@ -13,26 +13,20 @@ import os print "sconstruct", os.getcwd() """) -test.run(chdir = '.') - -test.fail_test(test.stdout() != ("sconstruct %s\n" % wpath)) +test.run(stdout = "sconstruct %s\n" % wpath) test.write('Sconstruct', """ import os print "Sconstruct", os.getcwd() """) -test.run(chdir = '.') - -test.fail_test(test.stdout() != ("Sconstruct %s\n" % wpath)) +test.run(stdout = "Sconstruct %s\n" % wpath) test.write('SConstruct', """ import os print "SConstruct", os.getcwd() """) -test.run(chdir = '.') - -test.fail_test(test.stdout() != ("SConstruct %s\n" % wpath)) +test.run(stdout = "SConstruct %s\n" % wpath) test.pass_test() diff --git a/test/errors.py b/test/errors.py index 09a741b..cff8087 100644 --- a/test/errors.py +++ b/test/errors.py @@ -7,14 +7,14 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct1', """ -a ! int(2.0) +a ! x """) -test.run(arguments='-f SConstruct1') -test.fail_test(test.stderr() != """ File "SConstruct1", line 2 - a ! int(2.0) +test.run(arguments='-f SConstruct1', stderr = """ File "SConstruct1", line 2 - ^ + a ! x + + \^ SyntaxError: invalid syntax @@ -24,18 +24,15 @@ SyntaxError: invalid syntax test.write('SConstruct2', """ raise UserError, 'Depends() require both sources and targets.' """) -test.run(arguments='-f SConstruct2') -test.fail_test(test.stderr() != """ -SCons error: Depends() require both sources and targets. -File "SConstruct2", line 2, in ? +test.run(arguments='-f SConstruct2', stderr = """ +SCons error: Depends\(\) require both sources and targets. +File "SConstruct2", line 2, in \? """) - test.write('SConstruct3', """ raise InternalError, 'error inside' """) -test.run(arguments='-f SConstruct3') -expect = r"""Traceback \((most recent call|innermost) last\): +test.run(arguments='-f SConstruct3', stderr = r"""Traceback \((most recent call|innermost) last\): File ".*scons\.py", line \d+, in \? main\(\) File ".*scons\.py", line \d+, in main @@ -43,7 +40,6 @@ expect = r"""Traceback \((most recent call|innermost) last\): File "SConstruct3", line \d+, in \? raise InternalError, 'error inside' InternalError: error inside -""" -test.fail_test(not test.match_re(test.stderr(), expect)) +""") test.pass_test() diff --git a/test/exitfns.py b/test/exitfns.py index 165f403..a13dd9b 100644 --- a/test/exitfns.py +++ b/test/exitfns.py @@ -2,9 +2,10 @@ __revision__ = "test/exitfns.py __REVISION__ __DATE__ __DEVELOPER__" +import TestCmd import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestCmd.match_exact) sconstruct = """ from scons.exitfuncs import * @@ -33,9 +34,7 @@ running x3('no kwd args', kwd=None) test.write('SConstruct', sconstruct) -test.run(arguments='-f SConstruct') - -test.fail_test(test.stdout() != expected_output) +test.run(arguments='-f SConstruct', stdout = expected_output) test.write('SConstruct', """import sys def f(): @@ -44,8 +43,6 @@ def f(): sys.exitfunc = f """ + sconstruct) -test.run(arguments='-f SConstruct') - -test.fail_test(test.stdout() != expected_output) +test.run(arguments='-f SConstruct', stdout = expected_output) test.pass_test() diff --git a/test/option--.py b/test/option--.py index f1f4f23..1529c46 100644 --- a/test/option--.py +++ b/test/option--.py @@ -26,10 +26,7 @@ env.MyBuild(target = '-f2.out', source = 'f2.in') expect = "python build.py -f1.out\npython build.py -f2.out\n" -test.run(arguments = '-- -f1.out -f2.out') - -test.fail_test(test.stdout() != expect) -test.fail_test(test.stderr() != "") +test.run(arguments = '-- -f1.out -f2.out', stdout = expect) test.fail_test(not os.path.exists(test.workpath('-f1.out'))) test.fail_test(not os.path.exists(test.workpath('-f2.out'))) diff --git a/test/option--C.py b/test/option--C.py index 7b3bc27..8af879a 100644 --- a/test/option--C.py +++ b/test/option--C.py @@ -29,30 +29,19 @@ import os print "sub/dir/SConstruct", os.getcwd() """) -test.run(arguments = '-C sub') +test.run(arguments = '-C sub', + stdout = "sub/SConstruct %s\n" % wpath_sub) -test.fail_test(test.stdout() != "sub/SConstruct %s\n" % wpath_sub) -test.fail_test(test.stderr() != "") +test.run(arguments = '-C sub -C dir', + stdout = "sub/dir/SConstruct %s\n" % wpath_sub_dir) -test.run(arguments = '-C sub -C dir') +test.run(stdout = "SConstruct %s\n" % wpath) -test.fail_test(test.stdout() != "sub/dir/SConstruct %s\n" % wpath_sub_dir) -test.fail_test(test.stderr() != "") +test.run(arguments = '--directory=sub/dir', + stdout = "sub/dir/SConstruct %s\n" % wpath_sub_dir) -test.run(chdir = '.') - -test.fail_test(test.stdout() != "SConstruct %s\n" % wpath) -test.fail_test(test.stderr() != "") - -test.run(arguments = '--directory=sub/dir') - -test.fail_test(test.stdout() != "sub/dir/SConstruct %s\n" % wpath_sub_dir) -test.fail_test(test.stderr() != "") - -test.run(arguments = '-C %s -C %s' % (wpath_sub_dir, wpath_sub)) - -test.fail_test(test.stdout() != "sub/SConstruct %s\n" % wpath_sub) -test.fail_test(test.stderr() != "") +test.run(arguments = '-C %s -C %s' % (wpath_sub_dir, wpath_sub), + stdout = "sub/SConstruct %s\n" % wpath_sub) test.pass_test() diff --git a/test/option--I.py b/test/option--I.py index eaf1440..7ca471d 100644 --- a/test/option--I.py +++ b/test/option--I.py @@ -29,15 +29,10 @@ import bar print bar.variable """) -test.run(arguments = '-I sub1 -I sub2') +test.run(arguments = '-I sub1 -I sub2', stdout = "sub1/foo\nsub2/bar\n") -test.fail_test(test.stdout() != "sub1/foo\nsub2/bar\n") -test.fail_test(test.stderr() != "") - -test.run(arguments = '--include-dir=sub2 --include-dir=sub1') - -test.fail_test(test.stdout() != "sub2/foo\nsub2/bar\n") -test.fail_test(test.stderr() != "") +test.run(arguments = '--include-dir=sub2 --include-dir=sub1', + stdout = "sub2/foo\nsub2/bar\n") test.pass_test() diff --git a/test/option--R.py b/test/option--R.py index 8676b5c..db7815b 100644 --- a/test/option--R.py +++ b/test/option--R.py @@ -10,15 +10,11 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-R') +test.run(arguments = '-R', + stderr = "Warning: the -R option is not yet implemented\n") -test.fail_test(test.stderr() != - "Warning: the -R option is not yet implemented\n") - -test.run(arguments = '--no-builtin-variables') - -test.fail_test(test.stderr() != - "Warning: the --no-builtin-variables option is not yet implemented\n") +test.run(arguments = '--no-builtin-variables', + stderr = "Warning: the --no-builtin-variables option is not yet implemented\n") test.pass_test() diff --git a/test/option--S.py b/test/option--S.py index fd3f50f..c7b04d6 100644 --- a/test/option--S.py +++ b/test/option--S.py @@ -10,20 +10,12 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-S') +test.run(arguments = '-S', stderr = "Warning: ignoring -S option\n") -test.fail_test(test.stderr() != - "Warning: ignoring -S option\n") +test.run(arguments = '--no-keep-going', + stderr = "Warning: ignoring --no-keep-going option\n") -test.run(arguments = '--no-keep-going') - -test.fail_test(test.stderr() != - "Warning: ignoring --no-keep-going option\n") - -test.run(arguments = '--stop') - -test.fail_test(test.stderr() != - "Warning: ignoring --stop option\n") +test.run(arguments = '--stop', stderr = "Warning: ignoring --stop option\n") test.pass_test() diff --git a/test/option--W.py b/test/option--W.py index e544973..a062d26 100644 --- a/test/option--W.py +++ b/test/option--W.py @@ -10,25 +10,17 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-W foo') +test.run(arguments = '-W foo', + stderr = "Warning: the -W option is not yet implemented\n") -test.fail_test(test.stderr() != - "Warning: the -W option is not yet implemented\n") +test.run(arguments = '--what-if=foo', + stderr = "Warning: the --what-if option is not yet implemented\n") -test.run(arguments = '--what-if=foo') +test.run(arguments = '--new-file=foo', + stderr = "Warning: the --new-file option is not yet implemented\n") -test.fail_test(test.stderr() != - "Warning: the --what-if option is not yet implemented\n") - -test.run(arguments = '--new-file=foo') - -test.fail_test(test.stderr() != - "Warning: the --new-file option is not yet implemented\n") - -test.run(arguments = '--assume-new=foo') - -test.fail_test(test.stderr() != - "Warning: the --assume-new option is not yet implemented\n") +test.run(arguments = '--assume-new=foo', + stderr = "Warning: the --assume-new option is not yet implemented\n") test.pass_test() diff --git a/test/option--Y.py b/test/option--Y.py index 0b57e35..9b5f72a 100644 --- a/test/option--Y.py +++ b/test/option--Y.py @@ -10,15 +10,11 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-Y foo') +test.run(arguments = '-Y foo', + stderr = "Warning: the -Y option is not yet implemented\n") -test.fail_test(test.stderr() != - "Warning: the -Y option is not yet implemented\n") - -test.run(arguments = '--repository=foo') - -test.fail_test(test.stderr() != - "Warning: the --repository option is not yet implemented\n") +test.run(arguments = '--repository=foo', + stderr = "Warning: the --repository option is not yet implemented\n") test.pass_test() diff --git a/test/option--cd.py b/test/option--cd.py index 75e1282..af3d170 100644 --- a/test/option--cd.py +++ b/test/option--cd.py @@ -10,15 +10,11 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--cache-disable') +test.run(arguments = '--cache-disable', + stderr = "Warning: the --cache-disable option is not yet implemented\n") -test.fail_test(test.stderr() != - "Warning: the --cache-disable option is not yet implemented\n") - -test.run(arguments = '--no-cache') - -test.fail_test(test.stderr() != - "Warning: the --no-cache option is not yet implemented\n") +test.run(arguments = '--no-cache', + stderr = "Warning: the --no-cache option is not yet implemented\n") test.pass_test() diff --git a/test/option--cf.py b/test/option--cf.py index a453d7f..4c106fc 100644 --- a/test/option--cf.py +++ b/test/option--cf.py @@ -10,15 +10,11 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--cache-force') +test.run(arguments = '--cache-force', + stderr = "Warning: the --cache-force option is not yet implemented\n") -test.fail_test(test.stderr() != - "Warning: the --cache-force option is not yet implemented\n") - -test.run(arguments = '--cache-populate') - -test.fail_test(test.stderr() != - "Warning: the --cache-populate option is not yet implemented\n") +test.run(arguments = '--cache-populate', + stderr = "Warning: the --cache-populate option is not yet implemented\n") test.pass_test() diff --git a/test/option--cs.py b/test/option--cs.py index e740341..39f19d9 100644 --- a/test/option--cs.py +++ b/test/option--cs.py @@ -10,10 +10,8 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--cache-show') - -test.fail_test(test.stderr() != - "Warning: the --cache-show option is not yet implemented\n") +test.run(arguments = '--cache-show', + stderr = "Warning: the --cache-show option is not yet implemented\n") test.pass_test() diff --git a/test/option--la.py b/test/option--la.py index e2d3165..2ebd95e 100644 --- a/test/option--la.py +++ b/test/option--la.py @@ -10,10 +10,8 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--list-actions') - -test.fail_test(test.stderr() != - "Warning: the --list-actions option is not yet implemented\n") +test.run(arguments = '--list-actions', + stderr = "Warning: the --list-actions option is not yet implemented\n") test.pass_test() diff --git a/test/option--ld.py b/test/option--ld.py index 4479bd5..66ce38d 100644 --- a/test/option--ld.py +++ b/test/option--ld.py @@ -10,10 +10,8 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--list-derived') - -test.fail_test(test.stderr() != - "Warning: the --list-derived option is not yet implemented\n") +test.run(arguments = '--list-derived', + stderr = "Warning: the --list-derived option is not yet implemented\n") test.pass_test() diff --git a/test/option--lw.py b/test/option--lw.py index 0a7b2c7..65c8acf 100644 --- a/test/option--lw.py +++ b/test/option--lw.py @@ -10,10 +10,8 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--list-where') - -test.fail_test(test.stderr() != - "Warning: the --list-where option is not yet implemented\n") +test.run(arguments = '--list-where', + stderr = "Warning: the --list-where option is not yet implemented\n") test.pass_test() diff --git a/test/option--npd.py b/test/option--npd.py index e210e1b..02c4d19 100644 --- a/test/option--npd.py +++ b/test/option--npd.py @@ -10,10 +10,8 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--no-print-directory') - -test.fail_test(test.stderr() != - "Warning: the --no-print-directory option is not yet implemented\n") +test.run(arguments = '--no-print-directory', + stderr = "Warning: the --no-print-directory option is not yet implemented\n") test.pass_test() diff --git a/test/option--override.py b/test/option--override.py index ce7adae..3b1bd82 100644 --- a/test/option--override.py +++ b/test/option--override.py @@ -10,10 +10,8 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--override=foo') - -test.fail_test(test.stderr() != - "Warning: the --override option is not yet implemented\n") +test.run(arguments = '--override=foo', + stderr = "Warning: the --override option is not yet implemented\n") test.pass_test() diff --git a/test/option--random.py b/test/option--random.py index 584c54d..12f88bc 100644 --- a/test/option--random.py +++ b/test/option--random.py @@ -10,10 +10,8 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--random') - -test.fail_test(test.stderr() != - "Warning: the --random option is not yet implemented\n") +test.run(arguments = '--random', + stderr = "Warning: the --random option is not yet implemented\n") test.pass_test() diff --git a/test/option--wf.py b/test/option--wf.py index fddf827..0b75b7a 100644 --- a/test/option--wf.py +++ b/test/option--wf.py @@ -10,10 +10,8 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--write-filenames=FILE') - -test.fail_test(test.stderr() != - "Warning: the --write-filenames option is not yet implemented\n") +test.run(arguments = '--write-filenames=FILE', + stderr = "Warning: the --write-filenames option is not yet implemented\n") test.pass_test() diff --git a/test/option--wuv.py b/test/option--wuv.py index 880accc..72b4557 100644 --- a/test/option--wuv.py +++ b/test/option--wuv.py @@ -10,10 +10,8 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--warn-undefined-variables') - -test.fail_test(test.stderr() != - "Warning: the --warn-undefined-variables option is not yet implemented\n") +test.run(arguments = '--warn-undefined-variables', + stderr = "Warning: the --warn-undefined-variables option is not yet implemented\n") test.pass_test() diff --git a/test/option-b.py b/test/option-b.py index b13fe55..b2a95bb 100644 --- a/test/option-b.py +++ b/test/option-b.py @@ -10,10 +10,8 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-b') - -test.fail_test(test.stderr() != - "Warning: ignoring -b option\n") +test.run(arguments = '-b', + stderr = "Warning: ignoring -b option\n") test.pass_test() diff --git a/test/option-c.py b/test/option-c.py index ab4d56b..406e438 100644 --- a/test/option-c.py +++ b/test/option-c.py @@ -10,20 +10,14 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-c') +test.run(arguments = '-c', + stderr = "Warning: the -c option is not yet implemented\n") -test.fail_test(test.stderr() != - "Warning: the -c option is not yet implemented\n") +test.run(arguments = '--clean', + stderr = "Warning: the --clean option is not yet implemented\n") -test.run(arguments = '--clean') - -test.fail_test(test.stderr() != - "Warning: the --clean option is not yet implemented\n") - -test.run(arguments = '--remove') - -test.fail_test(test.stderr() != - "Warning: the --remove option is not yet implemented\n") +test.run(arguments = '--remove', + stderr = "Warning: the --remove option is not yet implemented\n") test.pass_test() diff --git a/test/option-d.py b/test/option-d.py index c9708e0..b684490 100644 --- a/test/option-d.py +++ b/test/option-d.py @@ -10,10 +10,8 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-d') - -test.fail_test(test.stderr() != - "Warning: the -d option is not yet implemented\n") +test.run(arguments = '-d', + stderr = "Warning: the -d option is not yet implemented\n") test.pass_test() diff --git a/test/option-e.py b/test/option-e.py index db2b195..0fdf50e 100644 --- a/test/option-e.py +++ b/test/option-e.py @@ -10,15 +10,11 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-e') +test.run(arguments = '-e', + stderr = "Warning: the -e option is not yet implemented\n") -test.fail_test(test.stderr() != - "Warning: the -e option is not yet implemented\n") - -test.run(arguments = '--environment-overrides') - -test.fail_test(test.stderr() != - "Warning: the --environment-overrides option is not yet implemented\n") +test.run(arguments = '--environment-overrides', + stderr = "Warning: the --environment-overrides option is not yet implemented\n") test.pass_test() diff --git a/test/option-f.py b/test/option-f.py index 81120d1..ddd91b4 100644 --- a/test/option-f.py +++ b/test/option-f.py @@ -23,47 +23,38 @@ print "subdir/BuildThis", os.getcwd() wpath = test.workpath() -test.run(arguments = '-f SConscript') -test.fail_test(test.stdout() != ("SConscript %s\n" % wpath)) -test.fail_test(test.stderr() != "") +test.run(arguments = '-f SConscript', + stdout = "SConscript %s\n" % wpath) -test.run(arguments = '-f ' + subdir_BuildThis) -test.fail_test(test.stdout() != ("subdir/BuildThis %s\n" % wpath)) -test.fail_test(test.stderr() != "") +test.run(arguments = '-f ' + subdir_BuildThis, + stdout = "subdir/BuildThis %s\n" % wpath) -test.run(arguments = '--file=SConscript') -test.fail_test(test.stdout() != ("SConscript %s\n" % wpath)) -test.fail_test(test.stderr() != "") +test.run(arguments = '--file=SConscript', + stdout = "SConscript %s\n" % wpath) -test.run(arguments = '--file=' + subdir_BuildThis) -test.fail_test(test.stdout() != ("subdir/BuildThis %s\n" % wpath)) -test.fail_test(test.stderr() != "") +test.run(arguments = '--file=' + subdir_BuildThis, + stdout = "subdir/BuildThis %s\n" % wpath) -test.run(arguments = '--makefile=SConscript') -test.fail_test(test.stdout() != ("SConscript %s\n" % wpath)) -test.fail_test(test.stderr() != "") +test.run(arguments = '--makefile=SConscript', + stdout = "SConscript %s\n" % wpath) -test.run(arguments = '--makefile=' + subdir_BuildThis) -test.fail_test(test.stdout() != ("subdir/BuildThis %s\n" % wpath)) -test.fail_test(test.stderr() != "") +test.run(arguments = '--makefile=' + subdir_BuildThis, + stdout = "subdir/BuildThis %s\n" % wpath) -test.run(arguments = '--sconstruct=SConscript') -test.fail_test(test.stdout() != ("SConscript %s\n" % wpath)) -test.fail_test(test.stderr() != "") +test.run(arguments = '--sconstruct=SConscript', + stdout = "SConscript %s\n" % wpath) -test.run(arguments = '--sconstruct=' + subdir_BuildThis) -test.fail_test(test.stdout() != ("subdir/BuildThis %s\n" % wpath)) -test.fail_test(test.stderr() != "") +test.run(arguments = '--sconstruct=' + subdir_BuildThis, + stdout = "subdir/BuildThis %s\n" % wpath) test.run(arguments = '-f -', stdin = """ import os print "STDIN " + os.getcwd() -""") -test.fail_test(test.stdout() != ("STDIN %s\n" % wpath)) -test.fail_test(test.stderr() != "") +""", + stdout = "STDIN %s\n" % wpath) -test.run(arguments = '-f no_such_file') -test.fail_test(test.stdout() != "") -test.fail_test(test.stderr() != "Ignoring missing script 'no_such_file'\n") +test.run(arguments = '-f no_such_file', + stdout = "", + stderr = "Ignoring missing script 'no_such_file'\n") test.pass_test() diff --git a/test/option-i.py b/test/option-i.py index 1bc4e40..f3aa4eb 100644 --- a/test/option-i.py +++ b/test/option-i.py @@ -10,15 +10,11 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-i') +test.run(arguments = '-i', + stderr = "Warning: the -i option is not yet implemented\n") -test.fail_test(test.stderr() != - "Warning: the -i option is not yet implemented\n") - -test.run(arguments = '--ignore-errors') - -test.fail_test(test.stderr() != - "Warning: the --ignore-errors option is not yet implemented\n") +test.run(arguments = '--ignore-errors', + stderr = "Warning: the --ignore-errors option is not yet implemented\n") test.pass_test() diff --git a/test/option-k.py b/test/option-k.py index 69e431d..bf4b579 100644 --- a/test/option-k.py +++ b/test/option-k.py @@ -10,15 +10,11 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-k') +test.run(arguments = '-k', + stderr = "Warning: the -k option is not yet implemented\n") -test.fail_test(test.stderr() != - "Warning: the -k option is not yet implemented\n") - -test.run(arguments = '--keep-going') - -test.fail_test(test.stderr() != - "Warning: the --keep-going option is not yet implemented\n") +test.run(arguments = '--keep-going', + stderr = "Warning: the --keep-going option is not yet implemented\n") test.pass_test() diff --git a/test/option-l.py b/test/option-l.py index 5f75737..1a14638 100644 --- a/test/option-l.py +++ b/test/option-l.py @@ -10,20 +10,14 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-l 1') +test.run(arguments = '-l 1', + stderr = "Warning: the -l option is not yet implemented\n") -test.fail_test(test.stderr() != - "Warning: the -l option is not yet implemented\n") +test.run(arguments = '--load-average=1', + stderr = "Warning: the --load-average option is not yet implemented\n") -test.run(arguments = '--load-average=1') - -test.fail_test(test.stderr() != - "Warning: the --load-average option is not yet implemented\n") - -test.run(arguments = '--max-load=1') - -test.fail_test(test.stderr() != - "Warning: the --max-load option is not yet implemented\n") +test.run(arguments = '--max-load=1', + stderr = "Warning: the --max-load option is not yet implemented\n") test.pass_test() diff --git a/test/option-m.py b/test/option-m.py index 895323b..d8f1310 100644 --- a/test/option-m.py +++ b/test/option-m.py @@ -10,10 +10,8 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-m') - -test.fail_test(test.stderr() != - "Warning: ignoring -m option\n") +test.run(arguments = '-m', + stderr = "Warning: ignoring -m option\n") test.pass_test() diff --git a/test/option-n.py b/test/option-n.py index 0f8687a..122a38b 100644 --- a/test/option-n.py +++ b/test/option-n.py @@ -27,48 +27,30 @@ env.MyBuild(target = 'f2.out', source = 'f2.in') args = 'f1.out f2.out' expect = "python build.py f1.out\npython build.py f2.out\n" -test.run(arguments = args) - -test.fail_test(test.stdout() != expect) -test.fail_test(test.stderr() != "") +test.run(arguments = args, stdout = expect) test.fail_test(not os.path.exists(test.workpath('f1.out'))) test.fail_test(not os.path.exists(test.workpath('f2.out'))) os.unlink(test.workpath('f1.out')) os.unlink(test.workpath('f2.out')) -test.run(arguments = '-n ' + args) - -test.fail_test(test.stdout() != expect) -test.fail_test(test.stderr() != "") +test.run(arguments = '-n ' + args, stdout = expect) test.fail_test(os.path.exists(test.workpath('f1.out'))) test.fail_test(os.path.exists(test.workpath('f2.out'))) -test.run(arguments = '--no-exec ' + args) - -test.fail_test(test.stdout() != expect) -test.fail_test(test.stderr() != "") +test.run(arguments = '--no-exec ' + args, stdout = expect) test.fail_test(os.path.exists(test.workpath('f1.out'))) test.fail_test(os.path.exists(test.workpath('f2.out'))) -test.run(arguments = '--just-print ' + args) - -test.fail_test(test.stdout() != expect) -test.fail_test(test.stderr() != "") +test.run(arguments = '--just-print ' + args, stdout = expect) test.fail_test(os.path.exists(test.workpath('f1.out'))) test.fail_test(os.path.exists(test.workpath('f2.out'))) -test.run(arguments = '--dry-run ' + args) - -test.fail_test(test.stdout() != expect) -test.fail_test(test.stderr() != "") +test.run(arguments = '--dry-run ' + args, stdout = expect) test.fail_test(os.path.exists(test.workpath('f1.out'))) test.fail_test(os.path.exists(test.workpath('f2.out'))) -test.run(arguments = '--recon ' + args) - -test.fail_test(test.stdout() != expect) -test.fail_test(test.stderr() != "") +test.run(arguments = '--recon ' + args, stdout = expect) test.fail_test(os.path.exists(test.workpath('f1.out'))) test.fail_test(os.path.exists(test.workpath('f2.out'))) diff --git a/test/option-o.py b/test/option-o.py index 5be3d08..63453d3 100644 --- a/test/option-o.py +++ b/test/option-o.py @@ -10,20 +10,14 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-o foo') +test.run(arguments = '-o foo', + stderr = "Warning: the -o option is not yet implemented\n") -test.fail_test(test.stderr() != - "Warning: the -o option is not yet implemented\n") +test.run(arguments = '--old-file=foo', + stderr = "Warning: the --old-file option is not yet implemented\n") -test.run(arguments = '--old-file=foo') - -test.fail_test(test.stderr() != - "Warning: the --old-file option is not yet implemented\n") - -test.run(arguments = '--assume-old=foo') - -test.fail_test(test.stderr() != - "Warning: the --assume-old option is not yet implemented\n") +test.run(arguments = '--assume-old=foo', + stderr = "Warning: the --assume-old option is not yet implemented\n") test.pass_test() diff --git a/test/option-p.py b/test/option-p.py index 29d23b2..f760b9a 100644 --- a/test/option-p.py +++ b/test/option-p.py @@ -10,10 +10,8 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-p') - -test.fail_test(test.stderr() != - "Warning: the -p option is not yet implemented\n") +test.run(arguments = '-p', + stderr = "Warning: the -p option is not yet implemented\n") test.pass_test() diff --git a/test/option-q.py b/test/option-q.py index 41197c4..3cceab2 100644 --- a/test/option-q.py +++ b/test/option-q.py @@ -10,15 +10,11 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-q') +test.run(arguments = '-q', + stderr = "Warning: the -q option is not yet implemented\n") -test.fail_test(test.stderr() != - "Warning: the -q option is not yet implemented\n") - -test.run(arguments = '--question') - -test.fail_test(test.stderr() != - "Warning: the --question option is not yet implemented\n") +test.run(arguments = '--question', + stderr = "Warning: the --question option is not yet implemented\n") test.pass_test() diff --git a/test/option-r.py b/test/option-r.py index 6116b95..7d475d8 100644 --- a/test/option-r.py +++ b/test/option-r.py @@ -10,15 +10,11 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-r') +test.run(arguments = '-r', + stderr = "Warning: the -r option is not yet implemented\n") -test.fail_test(test.stderr() != - "Warning: the -r option is not yet implemented\n") - -test.run(arguments = '--no-builtin-rules') - -test.fail_test(test.stderr() != - "Warning: the --no-builtin-rules option is not yet implemented\n") +test.run(arguments = '--no-builtin-rules', + stderr = "Warning: the --no-builtin-rules option is not yet implemented\n") test.pass_test() diff --git a/test/option-s.py b/test/option-s.py index 4fdcafb..8df64af 100644 --- a/test/option-s.py +++ b/test/option-s.py @@ -24,30 +24,21 @@ env.MyBuild(target = 'f1.out', source = 'f1.in') env.MyBuild(target = 'f2.out', source = 'f2.in') """) -test.run(arguments = '-s f1.out f2.out') - -test.fail_test(test.stdout() != "") -test.fail_test(test.stderr() != "") +test.run(arguments = '-s f1.out f2.out', stdout = "") test.fail_test(not os.path.exists(test.workpath('f1.out'))) test.fail_test(not os.path.exists(test.workpath('f2.out'))) os.unlink(test.workpath('f1.out')) os.unlink(test.workpath('f2.out')) -test.run(arguments = '--silent f1.out f2.out') - -test.fail_test(test.stdout() != "") -test.fail_test(test.stderr() != "") +test.run(arguments = '--silent f1.out f2.out', stdout = "") test.fail_test(not os.path.exists(test.workpath('f1.out'))) test.fail_test(not os.path.exists(test.workpath('f2.out'))) os.unlink(test.workpath('f1.out')) os.unlink(test.workpath('f2.out')) -test.run(arguments = '--quiet f1.out f2.out') - -test.fail_test(test.stdout() != "") -test.fail_test(test.stderr() != "") +test.run(arguments = '--quiet f1.out f2.out', stdout = "") test.fail_test(not os.path.exists(test.workpath('f1.out'))) test.fail_test(not os.path.exists(test.workpath('f2.out'))) diff --git a/test/option-t.py b/test/option-t.py index 9aaa545..8657732 100644 --- a/test/option-t.py +++ b/test/option-t.py @@ -10,15 +10,11 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-t') +test.run(arguments = '-t', + stderr = "Warning: ignoring -t option\n") -test.fail_test(test.stderr() != - "Warning: ignoring -t option\n") - -test.run(arguments = '--touch') - -test.fail_test(test.stderr() != - "Warning: ignoring --touch option\n") +test.run(arguments = '--touch', + stderr = "Warning: ignoring --touch option\n") test.pass_test() diff --git a/test/option-u.py b/test/option-u.py index 6df875e..9c8fdf5 100644 --- a/test/option-u.py +++ b/test/option-u.py @@ -10,10 +10,8 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-u') - -test.fail_test(test.stderr() != - "Warning: the -u option is not yet implemented\n") +test.run(arguments = '-u', + stderr = "Warning: the -u option is not yet implemented\n") test.pass_test() diff --git a/test/option-v.py b/test/option-v.py index ae68236..d674aa4 100644 --- a/test/option-v.py +++ b/test/option-v.py @@ -10,19 +10,13 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-v') - expect = r"""SCons version \S+, by Steven Knight et al. Copyright 2001 Steven Knight """ -test.fail_test(not test.match_re(test.stdout(), expect)) -test.fail_test(test.stderr() != "") - -test.run(arguments = '--version') +test.run(arguments = '-v', stdout = expect) -test.fail_test(not test.match_re(test.stdout(), expect)) -test.fail_test(test.stderr() != "") +test.run(arguments = '--version', stdout = expect) test.pass_test() diff --git a/test/option-w.py b/test/option-w.py index a2db34d..d27c52f 100644 --- a/test/option-w.py +++ b/test/option-w.py @@ -10,15 +10,11 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-w') +test.run(arguments = '-w', + stderr = "Warning: the -w option is not yet implemented\n") -test.fail_test(test.stderr() != - "Warning: the -w option is not yet implemented\n") - -test.run(arguments = '--print-directory') - -test.fail_test(test.stderr() != - "Warning: the --print-directory option is not yet implemented\n") +test.run(arguments = '--print-directory', + stderr = "Warning: the --print-directory option is not yet implemented\n") test.pass_test() |