summaryrefslogtreecommitdiff
path: root/src/engine/SCons/JobTests.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/JobTests.py')
-rw-r--r--src/engine/SCons/JobTests.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/engine/SCons/JobTests.py b/src/engine/SCons/JobTests.py
index 4ac79ca..8cb12e7 100644
--- a/src/engine/SCons/JobTests.py
+++ b/src/engine/SCons/JobTests.py
@@ -19,9 +19,8 @@
# 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__ = "src/engine/SCons/JobTests.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/JobTests.py 5023 2010/06/14 22:05:46 scons"
import unittest
import random
@@ -39,7 +38,7 @@ num_jobs = 11
# how many tasks to perform for the test
num_tasks = num_jobs*5
-class DummyLock:
+class DummyLock(object):
"fake lock class to use if threads are not supported"
def acquire(self):
pass
@@ -47,13 +46,13 @@ class DummyLock:
def release(self):
pass
-class NoThreadsException:
+class NoThreadsException(object):
"raised by the ParallelTestCase if threads are not supported"
def __str__(self):
return "the interpreter doesn't support threads"
-class Task:
+class Task(object):
"""A dummy task class for testing purposes."""
def __init__(self, i, taskmaster):
@@ -113,7 +112,7 @@ class RandomTask(Task):
x = math.sin(i)
time.sleep(0.01)
-class ExceptionTask:
+class ExceptionTask(object):
"""A dummy task class for testing purposes."""
def __init__(self, i, taskmaster):
@@ -151,7 +150,7 @@ class ExceptionTask:
def exception_set(self):
self.taskmaster.exception_set()
-class Taskmaster:
+class Taskmaster(object):
"""A dummy taskmaster class for testing the job classes."""
def __init__(self, n, test_case, Task):
@@ -368,7 +367,7 @@ import SCons.Taskmaster
import SCons.Node
import time
-class DummyNodeInfo:
+class DummyNodeInfo(object):
def update(self, obj):
pass
@@ -397,7 +396,7 @@ class badnode (goodnode):
goodnode.__init__(self)
self.expect_to_be = SCons.Node.failed
def build(self, **kw):
- raise Exception, 'badnode exception'
+ raise Exception('badnode exception')
class slowbadnode (badnode):
def build(self, **kw):
@@ -406,11 +405,11 @@ class slowbadnode (badnode):
# it is faster than slowgoodnode then these could complete
# while the scheduler is sleeping.
time.sleep(0.05)
- raise Exception, 'slowbadnode exception'
+ raise Exception('slowbadnode exception')
class badpreparenode (badnode):
def prepare(self):
- raise Exception, 'badpreparenode exception'
+ raise Exception('badpreparenode exception')
class _SConsTaskTest(unittest.TestCase):
@@ -491,7 +490,7 @@ class _SConsTaskTest(unittest.TestCase):
self.failUnless(state in [SCons.Node.no_state, N.expect_to_be],
"Node %s got unexpected result: %s" % (N, state))
- self.failUnless(filter(lambda N: N.get_state(), testnodes),
+ self.failUnless([N for N in testnodes if N.get_state()],
"no nodes ran at all.")
@@ -526,8 +525,8 @@ if __name__ == "__main__":
result = runner.run(suite())
if (len(result.failures) == 0
and len(result.errors) == 1
- and type(result.errors[0][0]) == SerialTestCase
- and type(result.errors[0][1][0]) == NoThreadsException):
+ and isinstance(result.errors[0][0], SerialTestCase)
+ and isinstance(result.errors[0][1][0], NoThreadsException)):
sys.exit(2)
elif not result.wasSuccessful():
sys.exit(1)