summaryrefslogtreecommitdiff
path: root/src/engine/SCons/TaskmasterTests.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-10-03 06:26:58 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-10-03 06:26:58 +0200
commit27b47b5db42407baf5d704bf52c35015b2c0ad7b (patch)
tree320f8d5fc315c211f7d073891bd7117754f5f5b3 /src/engine/SCons/TaskmasterTests.py
parent6be31f5d140b81227911cabfc61d3802c76c1b61 (diff)
parentfabd454ddf505302bf41ef4da0609437c29d5605 (diff)
Merge branch 'release/3.0.0+repack-1'3.0.0+repack-1
Diffstat (limited to 'src/engine/SCons/TaskmasterTests.py')
-rw-r--r--src/engine/SCons/TaskmasterTests.py43
1 files changed, 29 insertions, 14 deletions
diff --git a/src/engine/SCons/TaskmasterTests.py b/src/engine/SCons/TaskmasterTests.py
index b1bd9d6..fab54cf 100644
--- a/src/engine/SCons/TaskmasterTests.py
+++ b/src/engine/SCons/TaskmasterTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2016 The SCons Foundation
+# Copyright (c) 2001 - 2017 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -22,7 +22,7 @@
#
from __future__ import division
-__revision__ = "src/engine/SCons/TaskmasterTests.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog"
+__revision__ = "src/engine/SCons/TaskmasterTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
import SCons.compat
@@ -697,7 +697,7 @@ class TaskmasterTestCase(unittest.TestCase):
tm = SCons.Taskmaster.Taskmaster([n3])
try:
t = tm.next_task()
- except SCons.Errors.UserError, e:
+ except SCons.Errors.UserError as e:
assert str(e) == "Dependency cycle: n3 -> n1 -> n2 -> n3", str(e)
else:
assert 'Did not catch expected UserError'
@@ -849,14 +849,18 @@ class TaskmasterTestCase(unittest.TestCase):
t = tm.next_task()
t.exception_set((MyException, "exception value"))
exc_caught = None
+ exc_actually_caught = None
+ exc_value = None
try:
t.prepare()
- except MyException, e:
+ except MyException as e:
exc_caught = 1
- except:
+ exc_value = e
+ except Exception as e:
+ exc_actually_caught = e
pass
- assert exc_caught, "did not catch expected MyException"
- assert str(e) == "exception value", e
+ assert exc_caught, "did not catch expected MyException: %s"%exc_actually_caught
+ assert str(exc_value) == "exception value", exc_value
assert built_text is None, built_text
# Regression test, make sure we prepare not only
@@ -904,7 +908,7 @@ class TaskmasterTestCase(unittest.TestCase):
t = tm.next_task()
try:
t.prepare()
- except Exception, e:
+ except Exception as e:
assert str(e) == "Executor.prepare() exception", e
else:
raise AssertionError("did not catch expected exception")
@@ -958,7 +962,7 @@ class TaskmasterTestCase(unittest.TestCase):
t = tm.next_task()
try:
t.execute()
- except SCons.Errors.BuildError, e:
+ except SCons.Errors.BuildError as e:
assert e.node == n4, e.node
assert e.errstr == "OtherError : ", e.errstr
assert len(e.exc_info) == 3, e.exc_info
@@ -1065,10 +1069,20 @@ class TaskmasterTestCase(unittest.TestCase):
assert t.exception == 3
try: 1//0
- except: pass
- t.exception_set(None)
+ except:
+ # Moved from below
+ t.exception_set(None)
+ #pass
+
+# import pdb; pdb.set_trace()
+
+ # Having this here works for python 2.x,
+ # but it is a tuple (None, None, None) when called outside
+ # an except statement
+ # t.exception_set(None)
+
exc_type, exc_value, exc_tb = t.exception
- assert exc_type is ZeroDivisionError, exc_type
+ assert exc_type is ZeroDivisionError, "Expecting ZeroDevisionError got:%s"%exc_type
exception_values = [
"integer division or modulo",
"integer division or modulo by zero",
@@ -1078,13 +1092,14 @@ class TaskmasterTestCase(unittest.TestCase):
class Exception1(Exception):
pass
- t.exception_set((Exception1, None))
+ # Previously value was None, but while PY2 None = "", in Py3 None != "", so set to ""
+ t.exception_set((Exception1, ""))
try:
t.exception_raise()
except:
exc_type, exc_value = sys.exc_info()[:2]
assert exc_type == Exception1, exc_type
- assert str(exc_value) == '', exc_value
+ assert str(exc_value) == '', "Expecting empty string got:%s (type %s)"%(exc_value,type(exc_value))
else:
assert 0, "did not catch expected exception"