diff options
author | Greg Noel <GregNoel@tigris.org> | 2010-04-15 00:02:59 (GMT) |
---|---|---|
committer | Greg Noel <GregNoel@tigris.org> | 2010-04-15 00:02:59 (GMT) |
commit | 9931fe6c59d330d0dbeea1c51456e3a9f94377d8 (patch) | |
tree | 0e17c9808475e40bfad54db43529ad01d411e6c2 /test | |
parent | 12ec17eedc70ee82421b27ff7dd84e947d4e6953 (diff) | |
download | SCons-9931fe6c59d330d0dbeea1c51456e3a9f94377d8.zip SCons-9931fe6c59d330d0dbeea1c51456e3a9f94377d8.tar.gz SCons-9931fe6c59d330d0dbeea1c51456e3a9f94377d8.tar.bz2 |
http://scons.tigris.org/issues/show_bug.cgi?id=2345
Apply the first part of the 'raise' fixer (the three-argument cases are not
converted and will need to wait until native support of with_traceback() is
available).
Diffstat (limited to 'test')
-rw-r--r-- | test/Errors/InternalError.py | 4 | ||||
-rw-r--r-- | test/Errors/UserError.py | 2 | ||||
-rw-r--r-- | test/Scanner/exception.py | 2 | ||||
-rw-r--r-- | test/Script-import.py | 2 | ||||
-rw-r--r-- | test/Subst/AllowSubstExceptions.py | 16 | ||||
-rw-r--r-- | test/exceptions.py | 6 | ||||
-rw-r--r-- | test/option/debug-stacktrace.py | 6 |
7 files changed, 19 insertions, 19 deletions
diff --git a/test/Errors/InternalError.py b/test/Errors/InternalError.py index 49d9fdd..8ed6da1 100644 --- a/test/Errors/InternalError.py +++ b/test/Errors/InternalError.py @@ -37,7 +37,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) test.write('SConstruct', """ assert "InternalError" not in globals() from SCons.Errors import InternalError -raise InternalError, 'error inside' +raise InternalError('error inside') """) test.run(stdout = "scons: Reading SConscript files ...\ninternal error\n", @@ -46,7 +46,7 @@ test.run(stdout = "scons: Reading SConscript files ...\ninternal error\n", File ".+", line \d+, in .+ File ".+", line \d+, in .+ File ".+SConstruct", line \d+, in .+ - raise InternalError, 'error inside' + raise InternalError\('error inside'\) InternalError: error inside """, status=2) diff --git a/test/Errors/UserError.py b/test/Errors/UserError.py index 0212a52..669260d 100644 --- a/test/Errors/UserError.py +++ b/test/Errors/UserError.py @@ -36,7 +36,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) test.write('SConstruct', """ assert "UserError" not in globals() import SCons.Errors -raise SCons.Errors.UserError, 'Depends() requires both sources and targets.' +raise SCons.Errors.UserError('Depends() requires both sources and targets.') """) expect = """ diff --git a/test/Scanner/exception.py b/test/Scanner/exception.py index 1e22931..5af7ac3 100644 --- a/test/Scanner/exception.py +++ b/test/Scanner/exception.py @@ -47,7 +47,7 @@ def kfile_scan(node, env, target, arg): contents = node.get_text_contents() exceptions = exception_re.findall(contents) if exceptions: - raise Exception, "kfile_scan error: %s" % exceptions[0] + raise Exception("kfile_scan error: %s" % exceptions[0]) includes = include_re.findall(contents) return includes diff --git a/test/Script-import.py b/test/Script-import.py index 2e1b609..98ae271 100644 --- a/test/Script-import.py +++ b/test/Script-import.py @@ -86,7 +86,7 @@ for var in old_SCons_Script_variables: except AttributeError: pass else: - raise Exception, "unexpected variable SCons.Script.%s" % var + raise Exception("unexpected variable SCons.Script.%s" % var) """) test.write("m4.py", """\ diff --git a/test/Subst/AllowSubstExceptions.py b/test/Subst/AllowSubstExceptions.py index 6401f7e..c49f62f 100644 --- a/test/Subst/AllowSubstExceptions.py +++ b/test/Subst/AllowSubstExceptions.py @@ -49,37 +49,37 @@ AllowSubstExceptions() try: env.subst('$NAME') except SCons.Errors.UserError, e: print e -else: raise Exception, "did not catch expected SCons.Errors.UserError" +else: raise Exception("did not catch expected SCons.Errors.UserError") try: env.subst('${NAME}') except SCons.Errors.UserError, e: print e -else: raise Exception, "did not catch expected SCons.Errors.UserError" +else: raise Exception("did not catch expected SCons.Errors.UserError") try: env.subst('${INDEX[999]}') except SCons.Errors.UserError, e: print e -else: raise Exception, "did not catch expected SCons.Errors.UserError" +else: raise Exception("did not catch expected SCons.Errors.UserError") try: env.subst_list('$NAME') except SCons.Errors.UserError, e: print e -else: raise Exception, "did not catch expected SCons.Errors.UserError" +else: raise Exception("did not catch expected SCons.Errors.UserError") try: env.subst_list('${NAME}') except SCons.Errors.UserError, e: print e -else: raise Exception, "did not catch expected SCons.Errors.UserError" +else: raise Exception("did not catch expected SCons.Errors.UserError") try: env.subst_list('${INDEX[999]}') except SCons.Errors.UserError, e: print e -else: raise Exception, "did not catch expected SCons.Errors.UserError" +else: raise Exception("did not catch expected SCons.Errors.UserError") try: env.subst('${1/0}') except SCons.Errors.UserError, e: print e -else: raise Exception, "did not catch expected SCons.Errors.UserError" +else: raise Exception("did not catch expected SCons.Errors.UserError") try: env.subst_list('${1/0}') except SCons.Errors.UserError, e: print e -else: raise Exception, "did not catch expected SCons.Errors.UserError" +else: raise Exception("did not catch expected SCons.Errors.UserError") AllowSubstExceptions(ZeroDivisionError) diff --git a/test/exceptions.py b/test/exceptions.py index 6a68c79..79d869c 100644 --- a/test/exceptions.py +++ b/test/exceptions.py @@ -36,7 +36,7 @@ SConstruct_path = test.workpath('SConstruct') test.write(SConstruct_path, """\ def func(source = None, target = None, env = None): - raise Exception, "func exception" + raise Exception("func exception") B = Builder(action = func) env = Environment(BUILDERS = { 'B' : B }) env.B(target = 'foo.out', source = 'foo.in') @@ -44,7 +44,7 @@ env.B(target = 'foo.out', source = 'foo.in') test.write('foo.in', "foo.in\n") -expected_stderr = """scons: \*\*\* \[foo.out\] Exception : func exception +expected_stderr = r"""scons: \*\*\* \[foo.out\] Exception : func exception Traceback \((most recent call|innermost) last\): ( File ".+", line \d+, in \S+ [^\n]+ @@ -52,7 +52,7 @@ Traceback \((most recent call|innermost) last\): )*( File ".+", line \d+, in \S+ [^\n]+ )* File "%s", line 2, in func - raise Exception, "func exception" + raise Exception\("func exception"\) Exception: func exception """ % re.escape(SConstruct_path) diff --git a/test/option/debug-stacktrace.py b/test/option/debug-stacktrace.py index b29b39d..fcc4c1b 100644 --- a/test/option/debug-stacktrace.py +++ b/test/option/debug-stacktrace.py @@ -34,7 +34,7 @@ test = TestSCons.TestSCons() test.write('SConstruct', """\ def kfile_scan(node, env, target): - raise Exception, "kfile_scan error" + raise Exception("kfile_scan error") kscan = Scanner(name = 'kfile', function = kfile_scan, @@ -57,7 +57,7 @@ test.run(arguments = "--debug=stacktrace", lines = [ "scons: *** [foo] Exception : kfile_scan error", "scons: internal stack trace:", - 'raise Exception, "kfile_scan error"', + 'raise Exception("kfile_scan error")', ] test.must_contain_all_lines(test.stderr(), lines) @@ -69,7 +69,7 @@ test.must_contain_all_lines(test.stderr(), lines) test.write('SConstruct', """\ import SCons.Errors -raise SCons.Errors.UserError, "explicit UserError!" +raise SCons.Errors.UserError("explicit UserError!") """) test.run(arguments = '--debug=stacktrace', |