diff options
author | Steven Knight <knight@baldmt.com> | 2001-09-15 13:46:11 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2001-09-15 13:46:11 (GMT) |
commit | fcd916513a1ad10e13479d4d604f239f7ea45c73 (patch) | |
tree | 4ddf60867e13b0ba12f5b37c6a4eaebc9a08ebaa /test/errors.py | |
parent | f4b5ccd3fdacad36cb124245591ea5bfaf4de12e (diff) | |
download | SCons-fcd916513a1ad10e13479d4d604f239f7ea45c73.zip SCons-fcd916513a1ad10e13479d4d604f239f7ea45c73.tar.gz SCons-fcd916513a1ad10e13479d4d604f239f7ea45c73.tar.bz2 |
Add a TestSCons module for common initialization of SCons tests.
Diffstat (limited to 'test/errors.py')
-rw-r--r-- | test/errors.py | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/test/errors.py b/test/errors.py index 54e26b9..09a741b 100644 --- a/test/errors.py +++ b/test/errors.py @@ -1,17 +1,15 @@ #!/usr/bin/env python -__revision__ = "test/t0003.py __REVISION__ __DATE__ __DEVELOPER__" +__revision__ = "test/errors.py __REVISION__ __DATE__ __DEVELOPER__" -import TestCmd +import TestSCons -test = TestCmd.TestCmd(program = 'scons.py', - workdir = '', - interpreter = 'python') +test = TestSCons.TestSCons() test.write('SConstruct1', """ a ! int(2.0) """) -test.run(chdir = '.', arguments='-f SConstruct1') +test.run(arguments='-f SConstruct1') test.fail_test(test.stderr() != """ File "SConstruct1", line 2 a ! int(2.0) @@ -26,34 +24,26 @@ SyntaxError: invalid syntax test.write('SConstruct2', """ raise UserError, 'Depends() require both sources and targets.' """) -test.run(chdir = '.', arguments='-f SConstruct2') +test.run(arguments='-f SConstruct2') test.fail_test(test.stderr() != """ SCons error: Depends() require both sources and targets. File "SConstruct2", line 2, in ? """) -import os -import string -sconspath = os.path.join(os.getcwd(), 'scons.py') - -# Since we're using regular expression matches below, escape any -# backslashes that ended up in the path name. (Hello, Windows!) -sconspath = string.replace(sconspath, '\\', '\\\\') - test.write('SConstruct3', """ raise InternalError, 'error inside' """) -test.run(chdir = '.', arguments='-f SConstruct3') +test.run(arguments='-f SConstruct3') expect = r"""Traceback \((most recent call|innermost) last\): - File "%s", line \d+, in \? + File ".*scons\.py", line \d+, in \? main\(\) - File "%s", line \d+, in main + File ".*scons\.py", line \d+, in main exec f in globals\(\) File "SConstruct3", line \d+, in \? raise InternalError, 'error inside' InternalError: error inside -""" % (sconspath, sconspath) +""" test.fail_test(not test.match_re(test.stderr(), expect)) test.pass_test() |