diff options
author | Steven Knight <knight@baldmt.com> | 2009-02-06 14:55:23 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2009-02-06 14:55:23 (GMT) |
commit | e112f6b49c9063e6a584ff4f7abf9d7a644eef30 (patch) | |
tree | 978573b4ff11f036428c0a08a89085313ad990fa /test/Errors | |
parent | 9405dad6e18db3934eec7b992e12a2016b1466db (diff) | |
download | SCons-e112f6b49c9063e6a584ff4f7abf9d7a644eef30.zip SCons-e112f6b49c9063e6a584ff4f7abf9d7a644eef30.tar.gz SCons-e112f6b49c9063e6a584ff4f7abf9d7a644eef30.tar.bz2 |
Commonize new string-search-in-output methods:
test.must_contain_all_lines()
test.must_contain_any_line()
test.must_not_contain_any_line()
Update tests to use them. Remove "import string" lines where the
change made them unnecessary.
Diffstat (limited to 'test/Errors')
-rw-r--r-- | test/Errors/Exception.py | 9 | ||||
-rw-r--r-- | test/Errors/execute-a-directory.py | 7 | ||||
-rw-r--r-- | test/Errors/non-executable-file.py | 7 | ||||
-rw-r--r-- | test/Errors/nonexistent-executable.py | 7 |
4 files changed, 4 insertions, 26 deletions
diff --git a/test/Errors/Exception.py b/test/Errors/Exception.py index 8485ce5..61bd74f 100644 --- a/test/Errors/Exception.py +++ b/test/Errors/Exception.py @@ -24,8 +24,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import string - import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) @@ -73,11 +71,6 @@ test.run(arguments='foo.out exit.out', stderr=expect, status=2) stdout = test.stdout() expect = "scons: `foo.out' is up to date." - -if string.find(stdout, expect) == -1: - print "Did not find expected string %s" % repr(expect) - print "STDOUT =======================================================" - print stdout - test.fail_test() +test.must_contain_all_lines(test.stdout(), [expect]) test.pass_test() diff --git a/test/Errors/execute-a-directory.py b/test/Errors/execute-a-directory.py index bcdcb7c..a13b4e0 100644 --- a/test/Errors/execute-a-directory.py +++ b/test/Errors/execute-a-directory.py @@ -99,11 +99,6 @@ else: Permission_denied % (test.workdir, 'f3'), Permission_denied % (test.workdir, 'f3'), ] - error_message_not_found = 1 - for err in errs: - if string.find(test.stderr(), err) != -1: - error_message_not_found = None - break - test.fail_test(error_message_not_found) + test.must_contain_any_line(test.stderr(), errs) test.pass_test() diff --git a/test/Errors/non-executable-file.py b/test/Errors/non-executable-file.py index d6e018b..3d5cd5b 100644 --- a/test/Errors/non-executable-file.py +++ b/test/Errors/non-executable-file.py @@ -93,11 +93,6 @@ else: Permission_denied % (not_executable, 'f1'), permission_denied % (not_executable, 'f1'), ] - error_message_not_found = 1 - for err in errs: - if string.find(test.stderr(), err) != -1: - error_message_not_found = None - break - test.fail_test(error_message_not_found) + test.must_contain_any_line(test.stderr(), errs) test.pass_test() diff --git a/test/Errors/nonexistent-executable.py b/test/Errors/nonexistent-executable.py index b2a9557..c2f7cfd 100644 --- a/test/Errors/nonexistent-executable.py +++ b/test/Errors/nonexistent-executable.py @@ -97,11 +97,6 @@ else: not_found_127 % (no_such_file, 'f1'), No_such % (no_such_file, 'f1'), ] - error_message_not_found = 1 - for err in errs: - if string.find(test.stderr(), err) != -1: - error_message_not_found = None - break - test.fail_test(error_message_not_found) + test.must_contain_any_line(test.stderr(), errs) test.pass_test() |