diff options
Diffstat (limited to 'test/option')
-rw-r--r-- | test/option/debug-count.py | 6 | ||||
-rw-r--r-- | test/option/debug-memory.py | 5 | ||||
-rw-r--r-- | test/option/debug-presub.py | 3 | ||||
-rw-r--r-- | test/option/debug-time.py | 7 | ||||
-rw-r--r-- | test/option/help-options.py | 16 | ||||
-rw-r--r-- | test/option/md5-chunksize.py | 4 | ||||
-rw-r--r-- | test/option/profile.py | 6 | ||||
-rw-r--r-- | test/option/stack-size.py | 4 | ||||
-rw-r--r-- | test/option/tree-all.py | 13 |
9 files changed, 28 insertions, 36 deletions
diff --git a/test/option/debug-count.py b/test/option/debug-count.py index a52e201..c233bf5 100644 --- a/test/option/debug-count.py +++ b/test/option/debug-count.py @@ -21,6 +21,7 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # +from __future__ import generators ### KEEP FOR COMPATIBILITY FIXERS __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -28,7 +29,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" Test that the --debug=count option works. """ -import string import re import TestSCons @@ -73,11 +73,11 @@ for args in ['-h --debug=count', '--debug=count']: test.run(arguments = args) stdout = test.stdout() - missing = filter(lambda o: find_object_count(o, stdout) is None, objects) + missing = [o for o in objects if find_object_count(o, stdout) is None] if missing: print "Missing the following object lines from '%s' output:" % args - print "\t", string.join(missing) + print "\t", ' '.join(missing) print "STDOUT ==========" print stdout test.fail_test(1) diff --git a/test/option/debug-memory.py b/test/option/debug-memory.py index 0838501..c9165ed 100644 --- a/test/option/debug-memory.py +++ b/test/option/debug-memory.py @@ -29,7 +29,6 @@ Test that the --debug=memory option works. """ import re -import string import TestSCons @@ -60,7 +59,7 @@ test.write('file.in', "file.in\n") test.run(arguments = '--debug=memory') -lines = string.split(test.stdout(), '\n') +lines = test.stdout().split('\n') test.fail_test(re.match(r'Memory before reading SConscript files: +\d+', lines[-5]) is None) test.fail_test(re.match(r'Memory after reading SConscript files: +\d+', lines[-4]) is None) @@ -71,7 +70,7 @@ test.fail_test(re.match(r'Memory after building targets: +\d+', lines[-2]) is No test.run(arguments = '-h --debug=memory') -lines = string.split(test.stdout(), '\n') +lines = test.stdout().split('\n') test.fail_test(re.match(r'Memory before reading SConscript files: +\d+', lines[-3]) is None) test.fail_test(re.match(r'Memory after reading SConscript files: +\d+', lines[-2]) is None) diff --git a/test/option/debug-presub.py b/test/option/debug-presub.py index b503821..28eeb83 100644 --- a/test/option/debug-presub.py +++ b/test/option/debug-presub.py @@ -39,10 +39,9 @@ sys.exit(0) test.write('SConstruct', """\ def cat(env, source, target): target = str(target[0]) - source = map(str, source) f = open(target, "wb") for src in source: - f.write(open(src, "rb").read()) + f.write(open(str(src), "rb").read()) f.close() FILE = Builder(action="$FILECOM") TEMP = Builder(action="$TEMPCOM") diff --git a/test/option/debug-time.py b/test/option/debug-time.py index d9ca237..a1e0254 100644 --- a/test/option/debug-time.py +++ b/test/option/debug-time.py @@ -25,7 +25,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons -import string import re import time @@ -110,7 +109,7 @@ complete_time = time.time() - start_time expected_total_time = complete_time - overhead pattern = r'Command execution time: (\d+\.\d+) seconds' -times = map(float, re.findall(pattern, test.stdout())) +times = list(map(float, re.findall(pattern, test.stdout()))) expected_command_time = reduce(lambda x, y: x + y, times, 0.0) @@ -153,7 +152,7 @@ outside of the 15%% tolerance. """ % locals()) if failures or warnings: - print string.join([test.stdout()] + failures + warnings, '\n') + print '\n'.join([test.stdout()] + failures + warnings) if failures: test.fail_test(1) @@ -190,7 +189,7 @@ outside of the 1%% tolerance. """ % locals()) if failures: - print string.join([test.stdout()] + failures, '\n') + print '\n'.join([test.stdout()] + failures) test.fail_test(1) test.run(arguments = "-j4 --debug=time . SLEEP=1") diff --git a/test/option/help-options.py b/test/option/help-options.py index 9a87306..0f4dd4d 100644 --- a/test/option/help-options.py +++ b/test/option/help-options.py @@ -21,6 +21,7 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # +from __future__ import generators ### KEEP FOR COMPATIBILITY FIXERS __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -29,7 +30,6 @@ Verify behavior of the -H and --help-options options. """ import re -import string import TestSCons @@ -53,13 +53,13 @@ test.must_contain_all_lines(test.stdout(), expect) ignored_re = re.compile('.*Ignored for compatibility\\.\n', re.S) stdout = ignored_re.sub('', test.stdout()) -lines = string.split(stdout, '\n') -lines = filter(lambda x: x[:3] == ' -', lines) -lines = map(lambda x: x[3:], lines) -lines = map(lambda x: x[0] == '-' and x[1:] or x, lines) -options = map(lambda x: string.split(x)[0], lines) -options = map(lambda x: x[-1] == ',' and x[:-1] or x, options) -lowered = map(lambda x: string.lower(x), options) +lines = stdout.split('\n') +lines = [x for x in lines if x[:3] == ' -'] +lines = [x[3:] for x in lines] +lines = [x[0] == '-' and x[1:] or x for x in lines] +options = [x.split()[0] for x in lines] +options = [x[-1] == ',' and x[:-1] or x for x in options] +lowered = [x.lower() for x in options] sorted = lowered[:] sorted.sort() if lowered != sorted: diff --git a/test/option/md5-chunksize.py b/test/option/md5-chunksize.py index 9d15e84..acd3492 100644 --- a/test/option/md5-chunksize.py +++ b/test/option/md5-chunksize.py @@ -24,8 +24,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import string - import TestSCons _python_ = TestSCons._python_ @@ -90,7 +88,7 @@ test.pass_test() # test2 = TestSCons.TestSCons() -if string.find(sys.platform, 'linux') == -1: +if sys.platform.find('linux') == -1: test2.skip_test("skipping test on non-Linux platform '%s'\n" % sys.platform) dd = test2.where_is('dd') diff --git a/test/option/profile.py b/test/option/profile.py index ed5bc0a..ab99dab 100644 --- a/test/option/profile.py +++ b/test/option/profile.py @@ -21,10 +21,10 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # +from __future__ import generators ### KEEP FOR COMPATIBILITY FIXERS __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import string import StringIO import sys @@ -96,8 +96,8 @@ expect = [ test.must_contain_all_lines(test.stdout(), expect) expect = 'Memory before reading SConscript files' -lines = string.split(test.stdout(), '\n') -memory_lines = filter(lambda l, e=expect: string.find(l, e) != -1, lines) +lines = test.stdout().split('\n') +memory_lines = [l for l in lines if l.find(expect) != -1] test.fail_test(len(memory_lines) != 1) diff --git a/test/option/stack-size.py b/test/option/stack-size.py index 9458356..3d7a715 100644 --- a/test/option/stack-size.py +++ b/test/option/stack-size.py @@ -24,8 +24,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import string - import TestSCons _python_ = TestSCons._python_ @@ -81,7 +79,7 @@ expected_stdout = test.wrap_stdout("""\ %(_python_)s ../build.py f2.out f2.in """ % locals()) -re_expected_stdout = string.replace(expected_stdout, '\\', '\\\\') +re_expected_stdout = expected_stdout.replace('\\', '\\\\') expect_unsupported = """ scons: warning: Setting stack size is unsupported by this version of Python: diff --git a/test/option/tree-all.py b/test/option/tree-all.py index 0bd1717..fc0f689 100644 --- a/test/option/tree-all.py +++ b/test/option/tree-all.py @@ -31,7 +31,6 @@ complete dependencies of a target. import TestSCons import sys -import string test = TestSCons.TestSCons() @@ -95,7 +94,7 @@ tree1 = """ """ % locals() test.run(arguments = "--tree=all Foo.xxx") -if string.count(test.stdout(), tree1) != 1: +if test.stdout().count(tree1) != 1: sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n') sys.stdout.write(test.stdout()) test.fail_test() @@ -158,13 +157,13 @@ tree3 = """ """ % locals() test.run(arguments = "--tree=all,prune .") -if string.count(test.stdout(), tree3) != 1: +if test.stdout().count(tree3) != 1: sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n') sys.stdout.write(test.stdout()) test.fail_test() test.run(arguments = "--tree=prune .") -if string.count(test.stdout(), tree3) != 1: +if test.stdout().count(tree3) != 1: sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n') sys.stdout.write(test.stdout()) test.fail_test() @@ -198,13 +197,13 @@ tree4 = """ test.run(arguments = '-c Foo.xxx') test.run(arguments = "--no-exec --tree=all,status Foo.xxx") -if string.count(test.stdout(), tree4) != 1: +if test.stdout().count(tree4) != 1: sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n') sys.stdout.write(test.stdout()) test.fail_test() test.run(arguments = "--no-exec --tree=status Foo.xxx") -if string.count(test.stdout(), tree4) != 1: +if test.stdout().count(tree4) != 1: sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n') sys.stdout.write(test.stdout()) test.fail_test() @@ -221,7 +220,7 @@ THIS SHOULD CAUSE A BUILD FAILURE test.run(arguments = "--tree=all Foo.xxx", status = 2, stderr = None) -if string.count(test.stdout(), tree1) != 1: +if test.stdout().count(tree1) != 1: sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n') sys.stdout.write(test.stdout()) test.fail_test() |