diff options
Diffstat (limited to 'test')
56 files changed, 394 insertions, 394 deletions
diff --git a/test/AS/nasm.py b/test/AS/nasm.py index be7db3e..551a5ab 100644 --- a/test/AS/nasm.py +++ b/test/AS/nasm.py @@ -69,7 +69,7 @@ else: # anyway...). nasm_format = 'elf' format_map = {} -for k, v in format_map.items(): +for k, v in list(format_map.items()): if sys.platform.find(k) != -1: nasm_format = v break diff --git a/test/Actions/unicode-signature.py b/test/Actions/unicode-signature.py index 0d0c469..0ba50c3 100644 --- a/test/Actions/unicode-signature.py +++ b/test/Actions/unicode-signature.py @@ -36,7 +36,7 @@ import TestSCons test = TestSCons.TestSCons() try: - unicode + str except NameError: import sys msg = "Unicode not supported by Python version %s; skipping test\n" diff --git a/test/AddOption/help.py b/test/AddOption/help.py index d50e595..a3fd7be 100644 --- a/test/AddOption/help.py +++ b/test/AddOption/help.py @@ -57,10 +57,10 @@ lines = test.stdout().split('\n') missing = [e for e in expected_lines if e not in lines] if missing: - print "====== STDOUT:" - print test.stdout() - print "====== Missing the following lines in the above AddOption() help output:" - print "\n".join(missing) + print("====== STDOUT:") + print(test.stdout()) + print("====== Missing the following lines in the above AddOption() help output:") + print("\n".join(missing)) test.fail_test() test.unlink('SConstruct') @@ -70,10 +70,10 @@ lines = test.stdout().split('\n') unexpected = [e for e in expected_lines if e in lines] if unexpected: - print "====== STDOUT:" - print test.stdout() - print "====== Unexpected lines in the above non-AddOption() help output:" - print "\n".join(unexpected) + print("====== STDOUT:") + print(test.stdout()) + print("====== Unexpected lines in the above non-AddOption() help output:") + print("\n".join(unexpected)) test.fail_test() test.pass_test() diff --git a/test/Batch/action-changed.py b/test/Batch/action-changed.py index dc2805a..d031432 100644 --- a/test/Batch/action-changed.py +++ b/test/Batch/action-changed.py @@ -54,7 +54,7 @@ sys.exit(0) """ test.write('build.py', build_py_contents % (python, 'one')) -os.chmod(test.workpath('build.py'), 0755) +os.chmod(test.workpath('build.py'), 0o755) test.write('SConstruct', """ env = Environment() @@ -81,7 +81,7 @@ test.must_match('f3.out', "one\nf3.in\n") test.up_to_date(arguments = '.') test.write('build.py', build_py_contents % (python, 'two')) -os.chmod(test.workpath('build.py'), 0755) +os.chmod(test.workpath('build.py'), 0o755) test.not_up_to_date(arguments = '.') diff --git a/test/Chmod.py b/test/Chmod.py index c00aea0..8b5fbe0 100644 --- a/test/Chmod.py +++ b/test/Chmod.py @@ -87,19 +87,19 @@ test.write('f10', "f10\n") test.subdir('d11') test.subdir('d12') -os.chmod(test.workpath('f1'), 0444) -os.chmod(test.workpath('f1-File'), 0444) -os.chmod(test.workpath('d2'), 0555) -os.chmod(test.workpath('d2-Dir'), 0555) -os.chmod(test.workpath('f3'), 0444) -os.chmod(test.workpath('d4'), 0555) -os.chmod(test.workpath('f5'), 0444) -os.chmod(test.workpath('Chmod-f7.in'), 0444) -os.chmod(test.workpath('f7.out-Chmod'), 0444) -os.chmod(test.workpath('f9'), 0444) -os.chmod(test.workpath('f10'), 0444) -os.chmod(test.workpath('d11'), 0555) -os.chmod(test.workpath('d12'), 0555) +os.chmod(test.workpath('f1'), 0o444) +os.chmod(test.workpath('f1-File'), 0o444) +os.chmod(test.workpath('d2'), 0o555) +os.chmod(test.workpath('d2-Dir'), 0o555) +os.chmod(test.workpath('f3'), 0o444) +os.chmod(test.workpath('d4'), 0o555) +os.chmod(test.workpath('f5'), 0o444) +os.chmod(test.workpath('Chmod-f7.in'), 0o444) +os.chmod(test.workpath('f7.out-Chmod'), 0o444) +os.chmod(test.workpath('f9'), 0o444) +os.chmod(test.workpath('f10'), 0o444) +os.chmod(test.workpath('d11'), 0o555) +os.chmod(test.workpath('d12'), 0o555) expect = test.wrap_stdout(read_str = """\ Chmod("f1", 0666) @@ -123,68 +123,68 @@ cat(["f8.out"], ["f8.in"]) test.run(options = '-n', arguments = '.', stdout = expect) s = stat.S_IMODE(os.stat(test.workpath('f1'))[stat.ST_MODE]) -test.fail_test(s != 0444) +test.fail_test(s != 0o444) s = stat.S_IMODE(os.stat(test.workpath('f1-File'))[stat.ST_MODE]) -test.fail_test(s != 0444) +test.fail_test(s != 0o444) s = stat.S_IMODE(os.stat(test.workpath('d2'))[stat.ST_MODE]) -test.fail_test(s != 0555) +test.fail_test(s != 0o555) s = stat.S_IMODE(os.stat(test.workpath('d2-Dir'))[stat.ST_MODE]) -test.fail_test(s != 0555) +test.fail_test(s != 0o555) test.must_not_exist('bar.out') s = stat.S_IMODE(os.stat(test.workpath('f3'))[stat.ST_MODE]) -test.fail_test(s != 0444) +test.fail_test(s != 0o444) s = stat.S_IMODE(os.stat(test.workpath('d4'))[stat.ST_MODE]) -test.fail_test(s != 0555) +test.fail_test(s != 0o555) s = stat.S_IMODE(os.stat(test.workpath('f5'))[stat.ST_MODE]) -test.fail_test(s != 0444) +test.fail_test(s != 0o444) test.must_not_exist('f6.out') test.must_not_exist('f7.out') s = stat.S_IMODE(os.stat(test.workpath('Chmod-f7.in'))[stat.ST_MODE]) -test.fail_test(s != 0444) +test.fail_test(s != 0o444) s = stat.S_IMODE(os.stat(test.workpath('f7.out-Chmod'))[stat.ST_MODE]) -test.fail_test(s != 0444) +test.fail_test(s != 0o444) test.must_not_exist('f8.out') s = stat.S_IMODE(os.stat(test.workpath('f9'))[stat.ST_MODE]) -test.fail_test(s != 0444) +test.fail_test(s != 0o444) s = stat.S_IMODE(os.stat(test.workpath('f10'))[stat.ST_MODE]) -test.fail_test(s != 0444) +test.fail_test(s != 0o444) s = stat.S_IMODE(os.stat(test.workpath('d11'))[stat.ST_MODE]) -test.fail_test(s != 0555) +test.fail_test(s != 0o555) s = stat.S_IMODE(os.stat(test.workpath('d12'))[stat.ST_MODE]) -test.fail_test(s != 0555) +test.fail_test(s != 0o555) test.run() s = stat.S_IMODE(os.stat(test.workpath('f1'))[stat.ST_MODE]) -test.fail_test(s != 0666) +test.fail_test(s != 0o666) s = stat.S_IMODE(os.stat(test.workpath('f1-File'))[stat.ST_MODE]) -test.fail_test(s != 0666) +test.fail_test(s != 0o666) s = stat.S_IMODE(os.stat(test.workpath('d2'))[stat.ST_MODE]) -test.fail_test(s != 0777) +test.fail_test(s != 0o777) s = stat.S_IMODE(os.stat(test.workpath('d2-Dir'))[stat.ST_MODE]) -test.fail_test(s != 0777) +test.fail_test(s != 0o777) test.must_match('bar.out', "bar.in\n") s = stat.S_IMODE(os.stat(test.workpath('f3'))[stat.ST_MODE]) -test.fail_test(s != 0666) +test.fail_test(s != 0o666) s = stat.S_IMODE(os.stat(test.workpath('d4'))[stat.ST_MODE]) -test.fail_test(s != 0777) +test.fail_test(s != 0o777) s = stat.S_IMODE(os.stat(test.workpath('f5'))[stat.ST_MODE]) -test.fail_test(s != 0666) +test.fail_test(s != 0o666) test.must_match('f6.out', "f6.in\n") test.must_match('f7.out', "f7.in\n") s = stat.S_IMODE(os.stat(test.workpath('Chmod-f7.in'))[stat.ST_MODE]) -test.fail_test(s != 0666) +test.fail_test(s != 0o666) s = stat.S_IMODE(os.stat(test.workpath('f7.out-Chmod'))[stat.ST_MODE]) -test.fail_test(s != 0666) +test.fail_test(s != 0o666) test.must_match('f8.out', "f8.in\n") s = stat.S_IMODE(os.stat(test.workpath('f9'))[stat.ST_MODE]) -test.fail_test(s != 0666) +test.fail_test(s != 0o666) s = stat.S_IMODE(os.stat(test.workpath('f10'))[stat.ST_MODE]) -test.fail_test(s != 0666) +test.fail_test(s != 0o666) s = stat.S_IMODE(os.stat(test.workpath('d11'))[stat.ST_MODE]) -test.fail_test(s != 0777) +test.fail_test(s != 0o777) s = stat.S_IMODE(os.stat(test.workpath('d12'))[stat.ST_MODE]) -test.fail_test(s != 0777) +test.fail_test(s != 0o777) test.pass_test() diff --git a/test/Configure/ConfigureDryRunError.py b/test/Configure/ConfigureDryRunError.py index b4be67e..a8c6309 100644 --- a/test/Configure/ConfigureDryRunError.py +++ b/test/Configure/ConfigureDryRunError.py @@ -97,7 +97,7 @@ test.checkLogAndStdout( ["Checking for C library %s... " % lib, newLog = test.read(test.workpath('config.log')) if newLog != oldLog: - print "Unexpected update of log file within a dry run" + print("Unexpected update of log file within a dry run") test.fail_test() test.pass_test() diff --git a/test/Configure/config-h.py b/test/Configure/config-h.py index cda6c3b..6c70c9c 100644 --- a/test/Configure/config-h.py +++ b/test/Configure/config-h.py @@ -135,19 +135,19 @@ test.run(stdout=expected_stdout) config_h = test.read(test.workpath('config.h')) if expected_config_h != config_h: - print "Unexpected config.h" - print "Expected: " - print "---------------------------------------------------------" - print repr(expected_config_h) - print "---------------------------------------------------------" - print "Found: " - print "---------------------------------------------------------" - print repr(config_h) - print "---------------------------------------------------------" - print "Stdio: " - print "---------------------------------------------------------" - print test.stdout() - print "---------------------------------------------------------" + print("Unexpected config.h") + print("Expected: ") + print("---------------------------------------------------------") + print(repr(expected_config_h)) + print("---------------------------------------------------------") + print("Found: ") + print("---------------------------------------------------------") + print(repr(config_h)) + print("---------------------------------------------------------") + print("Stdio: ") + print("---------------------------------------------------------") + print(test.stdout()) + print("---------------------------------------------------------") test.fail_test() expected_read_str = re.sub(r'\b((yes)|(no))\b', @@ -162,19 +162,19 @@ test.run(stdout=expected_stdout) config_h = test.read(test.workpath('config.h')) if expected_config_h != config_h: - print "Unexpected config.h" - print "Expected: " - print "---------------------------------------------------------" - print repr(expected_config_h) - print "---------------------------------------------------------" - print "Found: " - print "---------------------------------------------------------" - print repr(config_h) - print "---------------------------------------------------------" - print "Stdio: " - print "---------------------------------------------------------" - print test.stdout() - print "---------------------------------------------------------" + print("Unexpected config.h") + print("Expected: ") + print("---------------------------------------------------------") + print(repr(expected_config_h)) + print("---------------------------------------------------------") + print("Found: ") + print("---------------------------------------------------------") + print(repr(config_h)) + print("---------------------------------------------------------") + print("Stdio: ") + print("---------------------------------------------------------") + print(test.stdout()) + print("---------------------------------------------------------") test.fail_test() test.pass_test() diff --git a/test/Configure/implicit-cache.py b/test/Configure/implicit-cache.py index 0f04b1e..059fd4c 100644 --- a/test/Configure/implicit-cache.py +++ b/test/Configure/implicit-cache.py @@ -93,11 +93,11 @@ test.run_sconsign('-d .sconf_temp -e conftest_0.c --raw .sconsign.dblite') new_sconsign_dblite = test.stdout() if old_sconsign_dblite != new_sconsign_dblite: - print ".sconsign.dblite did not match:" - print "FIRST RUN ==========" - print old_sconsign_dblite - print "SECOND RUN ==========" - print new_sconsign_dblite + print(".sconsign.dblite did not match:") + print("FIRST RUN ==========") + print(old_sconsign_dblite) + print("SECOND RUN ==========") + print(new_sconsign_dblite) test.fail_test() test.pass_test() diff --git a/test/Copy-Action.py b/test/Copy-Action.py index 51635c5..ded158a 100644 --- a/test/Copy-Action.py +++ b/test/Copy-Action.py @@ -84,8 +84,8 @@ test.subdir('d5') test.write(['d5', 'f12.in'], "f12.in\n") test.write('f 13.in', "f 13.in\n") -os.chmod('f1.in', 0646) -os.chmod('f4.in', 0644) +os.chmod('f1.in', 0o646) +os.chmod('f4.in', 0o644) test.sleep() diff --git a/test/Deprecated/Options/Options.py b/test/Deprecated/Options/Options.py index 8116a63..61a12f3 100644 --- a/test/Deprecated/Options/Options.py +++ b/test/Deprecated/Options/Options.py @@ -237,7 +237,7 @@ opts.Save('options.saved', env) def checkSave(file, expected): gdict = {} ldict = {} - exec open(file, 'rU').read() in gdict, ldict + exec(open(file, 'rU').read(), gdict, ldict) assert expected == ldict, "%s\n...not equal to...\n%s" % (expected, ldict) # First test with no command line options diff --git a/test/Deprecated/SourceCode/BitKeeper/BitKeeper.py b/test/Deprecated/SourceCode/BitKeeper/BitKeeper.py index 28b8761..9a36eac 100644 --- a/test/Deprecated/SourceCode/BitKeeper/BitKeeper.py +++ b/test/Deprecated/SourceCode/BitKeeper/BitKeeper.py @@ -67,7 +67,7 @@ test.subdir('BK', 'import', ['import', 'sub']) # Test using BitKeeper to fetch from SCCS/s.file files. sccs = test.where_is('sccs') if not sccs: - print "Could not find SCCS, skipping sub-test of BitKeeper using SCCS files." + print("Could not find SCCS, skipping sub-test of BitKeeper using SCCS files.") else: test.subdir('work1', ['work1', 'SCCS'], @@ -167,9 +167,9 @@ sub/fff.in 1.1 -> 1.2: 1 lines rcs = test.where_is('rcs') ci = test.where_is('ci') if not rcs: - print "Could not find RCS,\nskipping sub-test of BitKeeper using RCS files." + print("Could not find RCS,\nskipping sub-test of BitKeeper using RCS files.") elif not ci: - print "Could not find the RCS ci command,\nskipping sub-test of BitKeeper using RCS files." + print("Could not find the RCS ci command,\nskipping sub-test of BitKeeper using RCS files.") else: test.subdir('work2', ['work2', 'RCS'], diff --git a/test/Deprecated/SourceCode/Subversion.py b/test/Deprecated/SourceCode/Subversion.py index a97c86f..ac3eb57 100644 --- a/test/Deprecated/SourceCode/Subversion.py +++ b/test/Deprecated/SourceCode/Subversion.py @@ -50,7 +50,7 @@ svnadmin = test.where_is('svnadmin') if not svn: test.skip_test("Could not find 'svnadmin'; skipping test(s).\n") -print "Short-circuiting this test until we support Subversion" +print("Short-circuiting this test until we support Subversion") test.pass_test() test.subdir('Subversion', 'import', ['import', 'sub'], 'work1', 'work2') diff --git a/test/GetBuildFailures/parallel.py b/test/GetBuildFailures/parallel.py index b7576af..101c2e2 100644 --- a/test/GetBuildFailures/parallel.py +++ b/test/GetBuildFailures/parallel.py @@ -102,8 +102,8 @@ error_45 = f4_error + f5_error error_54 = f5_error + f4_error if test.stderr() not in [error_45, error_54]: - print "Did not find the following output in list of expected strings:" - print test.stderr(), + print("Did not find the following output in list of expected strings:") + print(test.stderr(), end=' ') test.fail_test() # We jump through hoops above to try to make sure that the individual @@ -121,8 +121,8 @@ failed_45 = f4_failed + f5_failed failed_54 = f5_failed + f4_failed if test.stdout() not in [failed_45, failed_54]: - print "Did not find the following output in list of expected strings:" - print test.stdout(), + print("Did not find the following output in list of expected strings:") + print(test.stdout(), end=' ') test.fail_test() test.must_match(test.workpath('f3'), 'f3.in\n') diff --git a/test/Glob/glob-libpath.py b/test/Glob/glob-libpath.py index b09aab9..6ee06e6 100644 --- a/test/Glob/glob-libpath.py +++ b/test/Glob/glob-libpath.py @@ -77,10 +77,10 @@ test.write(['src', 'util', 'util.cpp'], """int i=0; test.run(arguments = '-Q .') if not test.match_re_dotall(test.stdout(), r".*(-L|/LIBPATH:)build[/\\]util.*"): - print repr(test.stdout())+" should contain -Lbuild/util or /LIBPATH:build\\util" + print(repr(test.stdout())+" should contain -Lbuild/util or /LIBPATH:build\\util") test.fail_test() if test.match_re_dotall(test.stdout(), r".*(-L|/LIBPATH:)src[/\\]util.*"): - print repr(test.stdout())+" should not contain -Lsrc/util or /LIBPATH:src\\util" + print(repr(test.stdout())+" should not contain -Lsrc/util or /LIBPATH:src\\util") test.fail_test() test.pass_test() diff --git a/test/Install/Install.py b/test/Install/Install.py index adadfd9..d66660b 100644 --- a/test/Install/Install.py +++ b/test/Install/Install.py @@ -129,7 +129,7 @@ test.must_match(['work', 'f2.out'], "f2.in\n") # if a target can not be unlinked before building it: test.write(['work', 'f1.in'], "f1.in again again\n") -os.chmod(test.workpath('work', 'export'), 0555) +os.chmod(test.workpath('work', 'export'), 0o555) f = open(f1_out, 'rb') diff --git a/test/Interactive/version.py b/test/Interactive/version.py index bbca9ef..295b9d3 100644 --- a/test/Interactive/version.py +++ b/test/Interactive/version.py @@ -76,7 +76,7 @@ expect2 = r"""scons>>> SCons by Steven Knight et al\.: stdout = test.stdout() + '\n' if not test.match_re(stdout, expect1) and not test.match_re(stdout, expect2): - print repr(stdout) + print(repr(stdout)) test.fail_test() diff --git a/test/Java/multi-step.py b/test/Java/multi-step.py index a8efcd4..add4208 100644 --- a/test/Java/multi-step.py +++ b/test/Java/multi-step.py @@ -557,7 +557,7 @@ test.must_exist(['buildout', 'jni', 'SampleTest.java']) # it doesn't exist. p = test.workpath('buildout', 'jni', 'SampleTest.class') if not os.path.exists(p): - print 'Warning: %s does not exist' % p + print('Warning: %s does not exist' % p) test.up_to_date(arguments = '.') diff --git a/test/MSVC/batch-longlines.py b/test/MSVC/batch-longlines.py index ef7233b..c584aba 100644 --- a/test/MSVC/batch-longlines.py +++ b/test/MSVC/batch-longlines.py @@ -1,61 +1,61 @@ -#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-"""
-Verify operation of Visual C/C++ batch builds with long lines.
-
-Only runs on Windows.
-"""
-
-import TestSCons
-
-test = TestSCons.TestSCons()
-
-test.skip_if_not_msvc()
-
-_python_ = TestSCons._python_
-
-for i in xrange(1,200):
- test.write('source-file-with-quite-a-long-name-maybe-unrealistic-but-who-cares-%05d.cxx'%i,
- '/* source file %d */\nint var%d;\n'%(i,i))
-
-test.write('SConstruct', """
-env = Environment(tools=['msvc', 'mslink'],
- MSVC_BATCH=ARGUMENTS.get('MSVC_BATCH'))
-env.SharedLibrary('mylib', Glob('source*.cxx'))
-""" % locals())
-
-test.run(arguments = 'MSVC_BATCH=1 .')
-
-test.must_exist('mylib.dll')
-
-test.pass_test()
-
-# Local Variables:
-# tab-width:4
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=4 shiftwidth=4:
+#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Verify operation of Visual C/C++ batch builds with long lines. + +Only runs on Windows. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.skip_if_not_msvc() + +_python_ = TestSCons._python_ + +for i in range(1,200): + test.write('source-file-with-quite-a-long-name-maybe-unrealistic-but-who-cares-%05d.cxx'%i, + '/* source file %d */\nint var%d;\n'%(i,i)) + +test.write('SConstruct', """ +env = Environment(tools=['msvc', 'mslink'], + MSVC_BATCH=ARGUMENTS.get('MSVC_BATCH')) +env.SharedLibrary('mylib', Glob('source*.cxx')) +""" % locals()) + +test.run(arguments = 'MSVC_BATCH=1 .') + +test.must_exist('mylib.dll') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/MSVC/msvc.py b/test/MSVC/msvc.py index c68fb45..6f5c8d6 100644 --- a/test/MSVC/msvc.py +++ b/test/MSVC/msvc.py @@ -181,9 +181,9 @@ slow = time.time() - start # using precompiled headers should be faster limit = slow*0.90 if fast >= limit: - print "Using precompiled headers was not fast enough:" - print "slow.obj: %.3fs" % slow - print "fast.obj: %.3fs (expected less than %.3fs)" % (fast, limit) + print("Using precompiled headers was not fast enough:") + print("slow.obj: %.3fs" % slow) + print("fast.obj: %.3fs (expected less than %.3fs)" % (fast, limit)) test.fail_test() # Modifying resource.h should cause both the resource and precompiled header to be rebuilt: diff --git a/test/QT/QTFLAGS.py b/test/QT/QTFLAGS.py index 008397a..b7172fc 100644 --- a/test/QT/QTFLAGS.py +++ b/test/QT/QTFLAGS.py @@ -147,7 +147,7 @@ test.must_exist(['work1', 'mmmmocFromH.cxx'], ['work1', 'mmmanother_ui_file.cxx']) def _flagTest(test,fileToContentsStart): - for f,c in fileToContentsStart.items(): + for f,c in list(fileToContentsStart.items()): if test.read(test.workpath('work1', f)).find(c) != 0: return 1 return 0 diff --git a/test/QT/copied-env.py b/test/QT/copied-env.py index efa91be..59a344d 100644 --- a/test/QT/copied-env.py +++ b/test/QT/copied-env.py @@ -70,8 +70,8 @@ moc_MyForm = [x for x in test.stdout().split('\n') if x.find('moc_MyForm') != -1 MYLIB_IMPL = [x for x in moc_MyForm if x.find('MYLIB_IMPL') != -1] if not MYLIB_IMPL: - print "Did not find MYLIB_IMPL on moc_MyForm compilation line:" - print test.stdout() + print("Did not find MYLIB_IMPL on moc_MyForm compilation line:") + print(test.stdout()) test.fail_test() test.pass_test() diff --git a/test/QT/warnings.py b/test/QT/warnings.py index a861b24..5e680f6 100644 --- a/test/QT/warnings.py +++ b/test/QT/warnings.py @@ -59,8 +59,8 @@ scons: warning: Generated moc file 'aaa.moc' is not included by 'aaa.cpp' """ + TestSCons.file_expr if not re.search(match12, test.stderr()): - print "Did not find expected regular expression in stderr:" - print test.stderr() + print("Did not find expected regular expression in stderr:") + print(test.stderr()) test.fail_test() os.environ['QTDIR'] = test.QT diff --git a/test/SConsignFile/use-dbhash.py b/test/SConsignFile/use-dbhash.py index 45e3e36..bd9b799 100644 --- a/test/SConsignFile/use-dbhash.py +++ b/test/SConsignFile/use-dbhash.py @@ -35,7 +35,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() try: - import dbhash + import dbm.bsd except ImportError: test.skip_test('No dbhash in this version of Python; skipping test.\n') diff --git a/test/SConsignFile/use-dbm.py b/test/SConsignFile/use-dbm.py index 75f088d..90983b3 100644 --- a/test/SConsignFile/use-dbm.py +++ b/test/SConsignFile/use-dbm.py @@ -35,7 +35,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() try: - import dbm + import dbm.ndbm except ImportError: test.skip_test('No dbm in this version of Python; skipping test.\n') diff --git a/test/SConsignFile/use-dumbdbm.py b/test/SConsignFile/use-dumbdbm.py index 9d48fe5..84f1dd4 100644 --- a/test/SConsignFile/use-dumbdbm.py +++ b/test/SConsignFile/use-dumbdbm.py @@ -35,7 +35,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() try: - import dumbdbm + import dbm.dumb except ImportError: test.skip_test('No dumbdbm in this version of Python; skipping test.\n') diff --git a/test/SConsignFile/use-gdbm.py b/test/SConsignFile/use-gdbm.py index 1eb3645..a7e4f59 100644 --- a/test/SConsignFile/use-gdbm.py +++ b/test/SConsignFile/use-gdbm.py @@ -35,7 +35,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() try: - import gdbm + import dbm.gnu except ImportError: test.skip_test('No gdbm in this version of Python; skipping test.\n') diff --git a/test/SHELL.py b/test/SHELL.py index 93ed0b1..faee27f 100644 --- a/test/SHELL.py +++ b/test/SHELL.py @@ -64,7 +64,7 @@ ofp.close() sys.exit(0) """ % locals()) -os.chmod(my_shell, 0755) +os.chmod(my_shell, 0o755) test.write('SConstruct', """\ env = Environment(SHELL = r'%(my_shell)s') diff --git a/test/Scanner/unicode.py b/test/Scanner/unicode.py index 55e22bd..7a72804 100644 --- a/test/Scanner/unicode.py +++ b/test/Scanner/unicode.py @@ -36,7 +36,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() try: - unicode + str except NameError: import sys msg = "Unicode not supported by Python version %s; skipping test\n" @@ -102,28 +102,28 @@ include utf16be.k foo.k 1 line 4 """) -contents = unicode("""\ +contents = str("""\ ascii.k 1 line 1 include ascii.inc ascii.k 1 line 3 """) test.write('ascii.k', contents.encode('ascii')) -contents = unicode("""\ +contents = str("""\ utf8.k 1 line 1 include utf8.inc utf8.k 1 line 3 """) test.write('utf8.k', codecs.BOM_UTF8 + contents.encode('utf-8')) -contents = unicode("""\ +contents = str("""\ utf16le.k 1 line 1 include utf16le.inc utf16le.k 1 line 3 """) test.write('utf16le.k', codecs.BOM_UTF16_LE + contents.encode('utf-16-le')) -contents = unicode("""\ +contents = str("""\ utf16be.k 1 line 1 include utf16be.inc utf16be.k 1 line 3 diff --git a/test/TEMPFILEPREFIX.py b/test/TEMPFILEPREFIX.py index f9b3240..8e756af 100644 --- a/test/TEMPFILEPREFIX.py +++ b/test/TEMPFILEPREFIX.py @@ -45,7 +45,7 @@ print sys.argv echo_py = test.workpath('echo.py') st = os.stat(echo_py) -os.chmod(echo_py, st[stat.ST_MODE]|0111) +os.chmod(echo_py, st[stat.ST_MODE]|0o111) test.write('SConstruct', """ import os diff --git a/test/TEX/TEX.py b/test/TEX/TEX.py index 24d4bdd..863144d 100644 --- a/test/TEX/TEX.py +++ b/test/TEX/TEX.py @@ -173,14 +173,14 @@ Run \texttt{latex}, then \texttt{bibtex}, then \texttt{latex} twice again \cite{ reruns = [x for x in output_lines if x.find('latex -interaction=nonstopmode -recorder rerun.tex') != -1] if len(reruns) != 2: - print "Expected 2 latex calls, got %s:" % len(reruns) - print '\n'.join(reruns) + print("Expected 2 latex calls, got %s:" % len(reruns)) + print('\n'.join(reruns)) test.fail_test() bibtex = [x for x in output_lines if x.find('bibtex bibtex-test') != -1] if len(bibtex) != 1: - print "Expected 1 bibtex call, got %s:" % len(bibtex) - print '\n'.join(bibtex) + print("Expected 1 bibtex call, got %s:" % len(bibtex)) + print('\n'.join(bibtex)) test.fail_test() test.pass_test() diff --git a/test/Value.py b/test/Value.py index f3ad458..025c6de 100644 --- a/test/Value.py +++ b/test/Value.py @@ -81,7 +81,7 @@ open(sys.argv[-1],'wb').write(" ".join(sys.argv[1:-2])) # to make sure there's no difference in behavior. for source_signature in ['MD5', 'timestamp-newer']: - print "Testing Value node with source signatures:", source_signature + print("Testing Value node with source signatures:", source_signature) test.write('SConstruct', SConstruct_content % locals()) diff --git a/test/Variables/Variables.py b/test/Variables/Variables.py index 454e32e..d0bf432 100644 --- a/test/Variables/Variables.py +++ b/test/Variables/Variables.py @@ -231,7 +231,7 @@ opts.Save('variables.saved', env) def checkSave(file, expected): gdict = {} ldict = {} - exec open(file, 'rU').read() in gdict, ldict + exec(open(file, 'rU').read(), gdict, ldict) assert expected == ldict, "%s\n...not equal to...\n%s" % (expected, ldict) # First test with no command line variables diff --git a/test/WhereIs.py b/test/WhereIs.py index dc127b6..07c3f6c 100644 --- a/test/WhereIs.py +++ b/test/WhereIs.py @@ -45,10 +45,10 @@ if sys.platform != 'win32': os.mkdir(sub2_xxx_exe) test.write(sub3_xxx_exe, "\n") -os.chmod(sub3_xxx_exe, 0777) +os.chmod(sub3_xxx_exe, 0o777) test.write(sub4_xxx_exe, "\n") -os.chmod(sub4_xxx_exe, 0777) +os.chmod(sub4_xxx_exe, 0o777) env_path = os.environ['PATH'] diff --git a/test/Win32/bad-drive.py b/test/Win32/bad-drive.py index f2a55b8..ff98b4e 100644 --- a/test/Win32/bad-drive.py +++ b/test/Win32/bad-drive.py @@ -50,8 +50,8 @@ for i in range(len(uppercase)-1, -1, -1): break if bad_drive is None: - print "All drive letters appear to be in use." - print "Cannot test SCons handling of invalid Windows drive letters." + print("All drive letters appear to be in use.") + print("Cannot test SCons handling of invalid Windows drive letters.") test.no_result(1); test.write('SConstruct', """ diff --git a/test/Win32/default-drive.py b/test/Win32/default-drive.py index f427a20..2bc14b1 100644 --- a/test/Win32/default-drive.py +++ b/test/Win32/default-drive.py @@ -59,7 +59,7 @@ test.write(['src', 'file.in'], "src/file.in\n") build_file_out = test.workpath('build', 'file.out') -print os.path.splitdrive(build_file_out)[1] +print(os.path.splitdrive(build_file_out)[1]) test.run(chdir = 'src', arguments = os.path.splitdrive(build_file_out)[1]) diff --git a/test/ZIP/ZIP.py b/test/ZIP/ZIP.py index af2450b..f2acad8 100644 --- a/test/ZIP/ZIP.py +++ b/test/ZIP/ZIP.py @@ -47,7 +47,7 @@ def zipfile_contains(zipfilename, names): for name in names: try: info=zf.getinfo(name) - except KeyError, e: # name not found + except KeyError as e: # name not found zf.close() return False return True diff --git a/test/ZIP/ZIPROOT.py b/test/ZIP/ZIPROOT.py index 96747a7..f3e4496 100644 --- a/test/ZIP/ZIPROOT.py +++ b/test/ZIP/ZIPROOT.py @@ -1,98 +1,98 @@ -#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-import os
-import stat
-
-import TestSCons
-
-_python_ = TestSCons._python_
-
-test = TestSCons.TestSCons()
-
-import zipfile
-
-def zipfile_contains(zipfilename, names):
- """Returns True if zipfilename contains all the names, False otherwise."""
- zf=zipfile.ZipFile(zipfilename, 'r')
- if type(names)==type(''):
- names=[names]
- for name in names:
- try:
- info=zf.getinfo(name)
- except KeyError, e: # name not found
- zf.close()
- return False
- return True
-
-def zipfile_files(fname):
- """Returns all the filenames in zip file fname."""
- zf = zipfile.ZipFile(fname, 'r')
- return [x.filename for x in zf.infolist()]
-
-test.subdir('sub1')
-test.subdir(['sub1', 'sub2'])
-
-test.write('SConstruct', """
-env = Environment(tools = ['zip'])
-env.Zip(target = 'aaa.zip', source = ['sub1/file1'], ZIPROOT='sub1')
-env.Zip(target = 'bbb.zip', source = ['sub1/file2', 'sub1/sub2/file2'], ZIPROOT='sub1')
-""" % locals())
-
-test.write(['sub1', 'file1'], "file1\n")
-test.write(['sub1', 'file2'], "file2a\n")
-test.write(['sub1', 'sub2', 'file2'], "file2b\n")
-
-test.run(arguments = 'aaa.zip', stderr = None)
-
-test.must_exist('aaa.zip')
-
-# TEST: Zip file should contain 'file1', not 'sub1/file1', because of ZIPROOT.
-zf=zipfile.ZipFile('aaa.zip', 'r')
-test.fail_test(zf.testzip() is not None)
-zf.close()
-
-files=zipfile_files('aaa.zip')
-test.fail_test(zipfile_files('aaa.zip') != ['file1'],
- message='Zip file aaa.zip has wrong files: %s'%repr(files))
-
-###
-
-test.run(arguments = 'bbb.zip', stderr = None)
-
-test.must_exist('bbb.zip')
-
-# TEST: Zip file should contain 'sub2/file2', not 'sub1/sub2/file2', because of ZIPROOT.
-zf=zipfile.ZipFile('bbb.zip', 'r')
-test.fail_test(zf.testzip() is not None)
-zf.close()
-
-files=zipfile_files('bbb.zip')
-test.fail_test(zipfile_files('bbb.zip') != ['file2', 'sub2/file2'],
- message='Zip file bbb.zip has wrong files: %s'%repr(files))
-
-
-test.pass_test()
+#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import os +import stat + +import TestSCons + +_python_ = TestSCons._python_ + +test = TestSCons.TestSCons() + +import zipfile + +def zipfile_contains(zipfilename, names): + """Returns True if zipfilename contains all the names, False otherwise.""" + zf=zipfile.ZipFile(zipfilename, 'r') + if type(names)==type(''): + names=[names] + for name in names: + try: + info=zf.getinfo(name) + except KeyError as e: # name not found + zf.close() + return False + return True + +def zipfile_files(fname): + """Returns all the filenames in zip file fname.""" + zf = zipfile.ZipFile(fname, 'r') + return [x.filename for x in zf.infolist()] + +test.subdir('sub1') +test.subdir(['sub1', 'sub2']) + +test.write('SConstruct', """ +env = Environment(tools = ['zip']) +env.Zip(target = 'aaa.zip', source = ['sub1/file1'], ZIPROOT='sub1') +env.Zip(target = 'bbb.zip', source = ['sub1/file2', 'sub1/sub2/file2'], ZIPROOT='sub1') +""" % locals()) + +test.write(['sub1', 'file1'], "file1\n") +test.write(['sub1', 'file2'], "file2a\n") +test.write(['sub1', 'sub2', 'file2'], "file2b\n") + +test.run(arguments = 'aaa.zip', stderr = None) + +test.must_exist('aaa.zip') + +# TEST: Zip file should contain 'file1', not 'sub1/file1', because of ZIPROOT. +zf=zipfile.ZipFile('aaa.zip', 'r') +test.fail_test(zf.testzip() is not None) +zf.close() + +files=zipfile_files('aaa.zip') +test.fail_test(zipfile_files('aaa.zip') != ['file1'], + message='Zip file aaa.zip has wrong files: %s'%repr(files)) + +### + +test.run(arguments = 'bbb.zip', stderr = None) + +test.must_exist('bbb.zip') + +# TEST: Zip file should contain 'sub2/file2', not 'sub1/sub2/file2', because of ZIPROOT. +zf=zipfile.ZipFile('bbb.zip', 'r') +test.fail_test(zf.testzip() is not None) +zf.close() + +files=zipfile_files('bbb.zip') +test.fail_test(zipfile_files('bbb.zip') != ['file2', 'sub2/file2'], + message='Zip file bbb.zip has wrong files: %s'%repr(files)) + + +test.pass_test() diff --git a/test/gnutools.py b/test/gnutools.py index e1b7e42..f79efe4 100644 --- a/test/gnutools.py +++ b/test/gnutools.py @@ -118,7 +118,7 @@ def testObject(test, obj, expect): line1 = contents.split('\n')[0] actual = ' '.join(line1.split()) if not expect == actual: - print "%s: %s != %s\n" % (obj, repr(expect), repr(actual)) + print("%s: %s != %s\n" % (obj, repr(expect), repr(actual))) test.fail_test() if sys.platform in ('win32', 'cygwin'): diff --git a/test/import.py b/test/import.py index ef5ee61..fb8a28c 100644 --- a/test/import.py +++ b/test/import.py @@ -185,8 +185,8 @@ for tool in tools: matched = 1 break if not matched: - print "Failed importing '%s', stderr:" % tool - print stderr + print("Failed importing '%s', stderr:" % tool) + print(stderr) failures.append(tool) test.fail_test(len(failures)) diff --git a/test/long-lines/signature.py b/test/long-lines/signature.py index bc5d11a..ce38bec 100644 --- a/test/long-lines/signature.py +++ b/test/long-lines/signature.py @@ -51,7 +51,7 @@ fp.write('FILEFLAG=%s\\n' % args[2]) fp.write('TIMESTAMP=%s\\n' % args[3]) """) -os.chmod(build_py, 0755) +os.chmod(build_py, 0o755) test.write('SConstruct', """\ arg = 'a_long_ignored_argument' diff --git a/test/option--random.py b/test/option--random.py index a9b9b9d..59592cb 100644 --- a/test/option--random.py +++ b/test/option--random.py @@ -66,7 +66,7 @@ tries = 0 max_tries = 10 while test.stdout() == non_random_output: if tries >= max_tries: - print "--random generated the non-random output %s times!" % max_tries + print("--random generated the non-random output %s times!" % max_tries) test.fail_test() tries = tries + 1 test.run(arguments = '-n -Q --random') @@ -84,7 +84,7 @@ tries = 0 max_tries = 10 while test.stdout() == non_random_output: if tries >= max_tries: - print "--random generated the non-random output %s times!" % max_tries + print("--random generated the non-random output %s times!" % max_tries) test.fail_test() tries = tries + 1 test.run(arguments = '-n -Q --random') diff --git a/test/option-v.py b/test/option-v.py index 680f541..8985db0 100644 --- a/test/option-v.py +++ b/test/option-v.py @@ -55,13 +55,13 @@ expect2 = r"""SCons by Steven Knight et al.: test.run(arguments = '-v') stdout = test.stdout() if not test.match_re(stdout, expect1) and not test.match_re(stdout, expect2): - print stdout + print(stdout) test.fail_test() test.run(arguments = '--version') stdout = test.stdout() if not test.match_re(stdout, expect1) and not test.match_re(stdout, expect2): - print stdout + print(stdout) test.fail_test() test.pass_test() diff --git a/test/option/debug-count.py b/test/option/debug-count.py index 3f8a23c..076d7fa 100644 --- a/test/option/debug-count.py +++ b/test/option/debug-count.py @@ -74,10 +74,10 @@ for args in ['-h --debug=count', '--debug=count']: 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", ' '.join(missing) - print "STDOUT ==========" - print stdout + print("Missing the following object lines from '%s' output:" % args) + print("\t", ' '.join(missing)) + print("STDOUT ==========") + print(stdout) test.fail_test(1) expect_warning = """ diff --git a/test/option/debug-time.py b/test/option/debug-time.py index 198d71d..7448e1c 100644 --- a/test/option/debug-time.py +++ b/test/option/debug-time.py @@ -20,7 +20,7 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # 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 division + __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -164,7 +164,7 @@ outside of the 15%% tolerance. """ % locals()) if failures or warnings: - print '\n'.join([test.stdout()] + failures + warnings) + print('\n'.join([test.stdout()] + failures + warnings)) if failures: test.fail_test(1) @@ -172,7 +172,7 @@ test.run(arguments = "--debug=time . SLEEP=0") command_time = get_command_time(test.stdout()) if command_time != 0.0: - print "Up-to-date run received non-zero command time of %s" % command_time + print("Up-to-date run received non-zero command time of %s" % command_time) test.fail_test() @@ -201,14 +201,14 @@ outside of the 1%% tolerance. """ % locals()) if failures: - print '\n'.join([test.stdout()] + failures) + print('\n'.join([test.stdout()] + failures)) test.fail_test(1) test.run(arguments = "-j4 --debug=time . SLEEP=1") command_time = get_command_time(test.stdout()) if command_time != 0.0: - print "Up-to-date run received non-zero command time of %s" % command_time + print("Up-to-date run received non-zero command time of %s" % command_time) test.fail_test() diff --git a/test/option/help-options.py b/test/option/help-options.py index 45bbfa0..1b23cb3 100644 --- a/test/option/help-options.py +++ b/test/option/help-options.py @@ -60,8 +60,8 @@ options = [x[-1] == ',' and x[:-1] or x for x in options] lowered = [x.lower() for x in options] ordered = sorted(lowered) if lowered != ordered: - print "lowered =", lowered - print "sorted =", ordered + print("lowered =", lowered) + print("sorted =", ordered) test.fail_test() test.pass_test() diff --git a/test/option/profile.py b/test/option/profile.py index d53c690..513da47 100644 --- a/test/option/profile.py +++ b/test/option/profile.py @@ -36,7 +36,7 @@ else: # when we drop support for Python 2.6. class StringIO(_StringIO): def write(self, s): - _StringIO.write(self, unicode(s)) + _StringIO.write(self, str(s)) import TestSCons diff --git a/test/scons-time/run/config/python.py b/test/scons-time/run/config/python.py index 6cf965b..57b732d 100644 --- a/test/scons-time/run/config/python.py +++ b/test/scons-time/run/config/python.py @@ -53,7 +53,7 @@ for arg in sys.argv[1:]: print 'my_python.py: %s' % profile """) -os.chmod(my_python_py, 0755) +os.chmod(my_python_py, 0o755) test.run(arguments = 'run -f config foo.tar.gz') diff --git a/test/scons-time/run/option/python.py b/test/scons-time/run/option/python.py index a28e23f..70feb70 100644 --- a/test/scons-time/run/option/python.py +++ b/test/scons-time/run/option/python.py @@ -49,7 +49,7 @@ for arg in sys.argv[1:]: sys.stdout.write('my_python.py: %s\\n' % profile) """) -os.chmod(my_python_py, 0755) +os.chmod(my_python_py, 0o755) test.run(arguments = 'run --python %s foo.tar.gz' % my_python_py) diff --git a/test/sconsign/nonwritable.py b/test/sconsign/nonwritable.py index 913dcf1..5ae55bb 100644 --- a/test/sconsign/nonwritable.py +++ b/test/sconsign/nonwritable.py @@ -78,7 +78,7 @@ test.write(['work1', 'foo.in'], "work1/foo.in\n") test.write(work1__sconsign_dblite, "") -os.chmod(work1__sconsign_dblite, 0444) +os.chmod(work1__sconsign_dblite, 0o444) test.run(chdir='work1', arguments='.') @@ -95,7 +95,7 @@ test.write(['work2', 'foo.in'], "work2/foo.in\n") pickle.dump({}, open(work2_sub1__sconsign, 'wb'), 1) pickle.dump({}, open(work2_sub2__sconsign, 'wb'), 1) -os.chmod(work2_sub1__sconsign, 0444) +os.chmod(work2_sub1__sconsign, 0o444) test.run(chdir='work2', arguments='.') diff --git a/test/sconsign/script/SConsignFile.py b/test/sconsign/script/SConsignFile.py index a9f79f4..71a7e6d 100644 --- a/test/sconsign/script/SConsignFile.py +++ b/test/sconsign/script/SConsignFile.py @@ -86,8 +86,8 @@ output.write(input.read()) sys.exit(0) """) -test.chmod(fake_cc_py, 0755) -test.chmod(fake_link_py, 0755) +test.chmod(fake_cc_py, 0o755) +test.chmod(fake_link_py, 0o755) # Note: We don't use os.path.join() representations of the file names # in the expected output because paths in the .sconsign files are diff --git a/test/sconsign/script/Signatures.py b/test/sconsign/script/Signatures.py index cfd2a7f..5babe67 100644 --- a/test/sconsign/script/Signatures.py +++ b/test/sconsign/script/Signatures.py @@ -105,8 +105,8 @@ output.write(input.read()) sys.exit(0) """) -test.chmod(fake_cc_py, 0755) -test.chmod(fake_link_py, 0755) +test.chmod(fake_cc_py, 0o755) +test.chmod(fake_link_py, 0o755) test.write('SConstruct', """ SConsignFile(None) diff --git a/test/sconsign/script/no-SConsignFile.py b/test/sconsign/script/no-SConsignFile.py index 829d650..70b18c8 100644 --- a/test/sconsign/script/no-SConsignFile.py +++ b/test/sconsign/script/no-SConsignFile.py @@ -94,8 +94,8 @@ output.write(input.read()) sys.exit(0) """) -test.chmod(fake_cc_py, 0755) -test.chmod(fake_link_py, 0755) +test.chmod(fake_cc_py, 0o755) +test.chmod(fake_link_py, 0o755) # Note: We don't use os.path.join() representations of the file names # in the expected output because paths in the .sconsign files are diff --git a/test/site_scons/sysdirs.py b/test/site_scons/sysdirs.py index c05ef67..d05f6a4 100644 --- a/test/site_scons/sysdirs.py +++ b/test/site_scons/sysdirs.py @@ -1,71 +1,71 @@ -#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-import TestSCons
-
-"""
-Verify site_scons system dirs are getting loaded.
-Uses an internal test fixture to get at the site_scons dirs.
-
-TODO: it would be great to test if it can actually load site_scons
-files from the system dirs, but the test harness can't put files in
-those dirs (which may not even exist on a build system).
-"""
-
-test = TestSCons.TestSCons()
-
-test.write('SConstruct', """
-import SCons.Script
-SCons.Script.Main.test_load_all_site_scons_dirs(Dir('.').path)
-""")
-
-test.run(arguments = '-Q .')
-
-import SCons.Platform
-platform = SCons.Platform.platform_default()
-if platform in ('win32', 'cygwin'):
- dir_to_check_for='Application Data'
-elif platform in ('darwin'):
- dir_to_check_for='Library'
-else:
- dir_to_check_for='.scons'
-
-if 'Loading site dir' not in test.stdout():
- print test.stdout()
- test.fail_test()
-if dir_to_check_for not in test.stdout():
- print test.stdout()
- test.fail_test()
-
-test.pass_test()
-
-# end of file
-
-# Local Variables:
-# tab-width:4
-# indent-tabs-mode:nil
-# End:
-# vim: set expandtab tabstop=4 shiftwidth=4:
+#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import TestSCons + +""" +Verify site_scons system dirs are getting loaded. +Uses an internal test fixture to get at the site_scons dirs. + +TODO: it would be great to test if it can actually load site_scons +files from the system dirs, but the test harness can't put files in +those dirs (which may not even exist on a build system). +""" + +test = TestSCons.TestSCons() + +test.write('SConstruct', """ +import SCons.Script +SCons.Script.Main.test_load_all_site_scons_dirs(Dir('.').path) +""") + +test.run(arguments = '-Q .') + +import SCons.Platform +platform = SCons.Platform.platform_default() +if platform in ('win32', 'cygwin'): + dir_to_check_for='Application Data' +elif platform in ('darwin'): + dir_to_check_for='Library' +else: + dir_to_check_for='.scons' + +if 'Loading site dir' not in test.stdout(): + print(test.stdout()) + test.fail_test() +if dir_to_check_for not in test.stdout(): + print(test.stdout()) + test.fail_test() + +test.pass_test() + +# end of file + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/spaces.py b/test/spaces.py index db1ae97..1309047 100644 --- a/test/spaces.py +++ b/test/spaces.py @@ -36,7 +36,7 @@ if sys.platform == 'win32': else: test.write('duplicate a file.sh', 'cp foo.in foo.out\n') copy = test.workpath('duplicate a file.sh') - os.chmod(test.workpath('duplicate a file.sh'), 0777) + os.chmod(test.workpath('duplicate a file.sh'), 0o777) test.write('SConstruct', r''' diff --git a/test/subdivide.py b/test/subdivide.py index 2978e08..44402c9 100644 --- a/test/subdivide.py +++ b/test/subdivide.py @@ -76,8 +76,8 @@ for s in sys.argv[2:]: ofp.write(open(s, 'rb').read()) """) -test.chmod(fake_cc_py, 0755) -test.chmod(fake_link_py, 0755) +test.chmod(fake_cc_py, 0o755) +test.chmod(fake_link_py, 0o755) test.write('SConstruct', """\ SConsignFile(None) diff --git a/test/update-release-info/update-release-info.py b/test/update-release-info/update-release-info.py index d3125c7..0db65ba 100644 --- a/test/update-release-info/update-release-info.py +++ b/test/update-release-info/update-release-info.py @@ -201,7 +201,7 @@ RELEASE 2.0.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE """, mode = 'r') -years = ', '.join(map(str, range(2001, this_year + 1))) +years = ', '.join(map(str, list(range(2001, this_year + 1)))) test.must_match(SConstruct, """ month_year = 'MONTH YEAR' copyright_years = %s |