diff options
author | Steven Knight <knight@baldmt.com> | 2010-05-12 05:21:33 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2010-05-12 05:21:33 (GMT) |
commit | 53fc08f1c8d9d4d0174247cb34b770342fd25068 (patch) | |
tree | db3ece8a678daf4f6d004096a05ddaaab94aa3a7 | |
parent | c94aad42405270dcfe9225d49fbf2aa2cae0b50d (diff) | |
download | SCons-53fc08f1c8d9d4d0174247cb34b770342fd25068.zip SCons-53fc08f1c8d9d4d0174247cb34b770342fd25068.tar.gz SCons-53fc08f1c8d9d4d0174247cb34b770342fd25068.tar.bz2 |
Convert old-style utility classes in unit test files (*Tests.py)
to new-style classes.
25 files changed, 127 insertions, 127 deletions
diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index 529ce6e..ae909a8 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -32,7 +32,7 @@ import SCons.compat def GlobalFunc(): pass -class GlobalActFunc: +class GlobalActFunc(object): def __call__(self): pass @@ -101,7 +101,7 @@ scons_env = SCons.Environment.Environment() # so it doesn't clutter the output. sys.stdout = io.StringIO() -class CmdStringHolder: +class CmdStringHolder(object): def __init__(self, cmd, literal=None): self.data = str(cmd) self.literal = literal @@ -126,7 +126,7 @@ class CmdStringHolder: else: return self.data -class Environment: +class Environment(object): def __init__(self, **kw): self.d = {} self.d['SHELL'] = scons_env['SHELL'] @@ -170,7 +170,7 @@ class Environment: d['SOURCE'] = d['SOURCES'][0] return d -class DummyNode: +class DummyNode(object): def __init__(self, name): self.name = name def str_for_display(self): @@ -950,17 +950,17 @@ class CommandActionTestCase(unittest.TestCase): s = act.strfunction([], [], env) assert s == "sf was called", s - class actclass1: + class actclass1(object): def __init__(self, targets, sources, env): pass def __call__(self): return 1 - class actclass2: + class actclass2(object): def __init__(self, targets, sources, env): self.strfunction = 5 def __call__(self): return 2 - class actclass3: + class actclass3(object): def __init__(self, targets, sources, env): pass def __call__(self): @@ -968,7 +968,7 @@ class CommandActionTestCase(unittest.TestCase): def strfunction(self, targets, sources, env): return 'actclass3 on %s to get %s'%(str(sources[0]), str(targets[0])) - class actclass4: + class actclass4(object): def __init__(self, targets, sources, env): pass def __call__(self): @@ -1097,7 +1097,7 @@ class CommandActionTestCase(unittest.TestCase): c = test.read(outfile, 'r') assert c == "act.py: 'out5' 'XYZZY'\nact.py: 'xyzzy5'\n", c - class Obj: + class Obj(object): def __init__(self, str): self._str = str def __str__(self): @@ -1255,7 +1255,7 @@ class CommandActionTestCase(unittest.TestCase): def test_set_handler(self): """Test setting the command handler... """ - class Test: + class Test(object): def __init__(self): self.executed = 0 t=Test() @@ -1266,7 +1266,7 @@ class CommandActionTestCase(unittest.TestCase): def escape_func(cmd): return '**' + cmd + '**' - class LiteralStr: + class LiteralStr(object): def __init__(self, x): self.data = x def __str__(self): @@ -1452,7 +1452,7 @@ class CommandGeneratorActionTestCase(unittest.TestCase): assert self.dummy==2, self.dummy del self.dummy - class DummyFile: + class DummyFile(object): def __init__(self, t): self.t = t def rfile(self): @@ -1567,7 +1567,7 @@ class FunctionActionTestCase(unittest.TestCase): s = str(a) assert s == "func1(target, source, env)", s - class class1: + class class1(object): def __call__(self): pass a = SCons.Action.FunctionAction(class1(), {}) @@ -1611,7 +1611,7 @@ class FunctionActionTestCase(unittest.TestCase): c = test.read(outfile2, 'r') assert c == "function1\n", c - class class1a: + class class1a(object): def __init__(self, target, source, env): open(env['out'], 'w').write("class1a\n") @@ -1621,7 +1621,7 @@ class FunctionActionTestCase(unittest.TestCase): c = test.read(outfile, 'r') assert c == "class1a\n", c - class class1b: + class class1b(object): def __call__(self, target, source, env): open(env['out'], 'w').write("class1b\n") return 2 @@ -1689,14 +1689,14 @@ class FunctionActionTestCase(unittest.TestCase): c = a.get_contents(target=[], source=[], env=Environment(XYZ='foo')) assert c in matches_foo, repr(c) - class Foo: + class Foo(object): def get_contents(self, target, source, env): return 'xyzzy' a = factory(Foo()) c = a.get_contents(target=[], source=[], env=Environment()) assert c == 'xyzzy', repr(c) - class LocalClass: + class LocalClass(object): def LocalMethod(self): pass lc = LocalClass() @@ -1778,12 +1778,12 @@ class ListActionTestCase(unittest.TestCase): open(env['out'], 'a').write("function2\n") return 0 - class class2a: + class class2a(object): def __call__(self, target, source, env): open(env['out'], 'a').write("class2a\n") return 0 - class class2b: + class class2b(object): def __init__(self, target, source, env): open(env['out'], 'a').write("class2b\n") act = SCons.Action.ListAction([cmd2, function2, class2a(), class2b]) @@ -1935,7 +1935,7 @@ class ActionCallerTestCase(unittest.TestCase): "d\x00\x00S" ] - class LocalActFunc: + class LocalActFunc(object): def __call__(self): pass diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py index 7ba4f8e..766b8fe 100644 --- a/src/engine/SCons/BuilderTests.py +++ b/src/engine/SCons/BuilderTests.py @@ -71,7 +71,7 @@ scons_env = SCons.Environment.Environment() env_arg2nodes_called = None -class Environment: +class Environment(object): def __init__(self, **kw): self.d = {} self.d['SHELL'] = scons_env['SHELL'] @@ -147,7 +147,7 @@ class Environment: def __cmp__(self, other): return cmp(self.scanner, other.scanner) or cmp(self.d, other.d) -class MyAction: +class MyAction(object): def __init__(self, action): self.action = action def __call__(self, *args, **kw): @@ -155,7 +155,7 @@ class MyAction: def get_executor(self, env, overrides, tlist, slist, executor_kw): return ['executor'] + [self.action] -class MyNode_without_target_from_source: +class MyNode_without_target_from_source(object): def __init__(self, name): self.name = name self.sources = [] @@ -218,7 +218,7 @@ class BuilderTestCase(unittest.TestCase): exc_caught = 1 assert exc_caught, "did not catch expected InternalError exception" - class Node: + class Node(object): pass n = Node() @@ -423,7 +423,7 @@ class BuilderTestCase(unittest.TestCase): def test_target_factory(self): """Test a Builder that creates target nodes of a specified class """ - class Foo: + class Foo(object): pass def FooFactory(target): global Foo @@ -435,7 +435,7 @@ class BuilderTestCase(unittest.TestCase): def test_source_factory(self): """Test a Builder that creates source nodes of a specified class """ - class Foo: + class Foo(object): pass def FooFactory(source): global Foo @@ -842,7 +842,7 @@ class BuilderTestCase(unittest.TestCase): def test_target_scanner(self): """Testing ability to set target and source scanners through a builder.""" global instanced - class TestScanner: + class TestScanner(object): pass tscan = TestScanner() sscan = TestScanner() @@ -884,7 +884,7 @@ class BuilderTestCase(unittest.TestCase): def test_src_scanner(slf): """Testing ability to set a source file scanner through a builder.""" - class TestScanner: + class TestScanner(object): def key(self, env): return 'TestScannerkey' def instance(self, env): @@ -913,7 +913,7 @@ class BuilderTestCase(unittest.TestCase): # An Environment that has suffix-specified SCANNERS should # provide a source scanner to the target. - class EnvTestScanner: + class EnvTestScanner(object): def key(self, env): return '.y' def instance(self, env): diff --git a/src/engine/SCons/CacheDirTests.py b/src/engine/SCons/CacheDirTests.py index 5447509..21b435a 100644 --- a/src/engine/SCons/CacheDirTests.py +++ b/src/engine/SCons/CacheDirTests.py @@ -34,7 +34,7 @@ import SCons.CacheDir built_it = None -class Action: +class Action(object): def __call__(self, targets, sources, env, **kw): global built_it if kw.get('execute', 1): @@ -45,7 +45,7 @@ class Action: def get_contents(self, target, source, env): return '' -class Builder: +class Builder(object): def __init__(self, environment, action): self.env = environment self.action = action @@ -53,7 +53,7 @@ class Builder: self.source_scanner = None self.target_scanner = None -class Environment: +class Environment(object): def __init__(self, cachedir): self.cachedir = cachedir def Override(self, overrides): diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index ce4e040..3f70514 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -100,7 +100,7 @@ class Builder(SCons.Builder.BuilderBase): scanned_it = {} -class Scanner: +class Scanner(object): """A dummy Scanner class for testing purposes. "Scanning" a target is simply setting a value in the dictionary. """ @@ -140,7 +140,7 @@ class CLVar(UL): -class DummyNode: +class DummyNode(object): def __init__(self, name): self.name = name def __str__(self): @@ -153,7 +153,7 @@ class DummyNode: def test_tool( env ): env['_F77INCFLAGS'] = '$( ${_concat(INCPREFIX, F77PATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' -class TestEnvironmentFixture: +class TestEnvironmentFixture(object): def TestEnvironment(self, *args, **kw): if not kw or 'tools' not in kw: kw['tools'] = [test_tool] @@ -295,7 +295,7 @@ class SubstitutionTestCase(unittest.TestCase): assert len(nodes) == 1, nodes assert isinstance(nodes[0], SConsNode), node - class OtherNode: + class OtherNode(object): pass nodes = env.arg2nodes(OtherNode()) assert len(nodes) == 1, nodes @@ -537,13 +537,13 @@ class SubstitutionTestCase(unittest.TestCase): def test_subst_path(self): """Test substituting a path list """ - class MyProxy: + class MyProxy(object): def __init__(self, val): self.val = val def get(self): return self.val + '-proxy' - class MyNode: + class MyNode(object): def __init__(self, val): self.val = val def get_subst_proxy(self): @@ -551,7 +551,7 @@ class SubstitutionTestCase(unittest.TestCase): def __str__(self): return self.val - class MyObj: + class MyObj(object): def get(self): return self @@ -583,7 +583,7 @@ class SubstitutionTestCase(unittest.TestCase): r = env.subst_path(['$PROXY', MyProxy('my2'), n]) assert r == ['my1-proxy', 'my2-proxy', n], r - class StringableObj: + class StringableObj(object): def __init__(self, s): self.s = s def __str__(self): @@ -904,7 +904,7 @@ class BaseTestCase(unittest.TestCase,TestEnvironmentFixture): def test_variables(self): """Test that variables only get applied once.""" - class FakeOptions: + class FakeOptions(object): def __init__(self, key, val): self.calls = 0 self.key = key @@ -1305,7 +1305,7 @@ env4.builder1.env, env3) def test_platform(self): """Test specifying a platform callable when instantiating.""" - class platform: + class platform(object): def __str__(self): return "TestPlatform" def __call__(self, env): env['XYZZY'] = 777 @@ -1320,7 +1320,7 @@ env4.builder1.env, env3) def test_Default_PLATFORM(self): """Test overriding the default PLATFORM variable""" - class platform: + class platform(object): def __str__(self): return "DefaultTestPlatform" def __call__(self, env): env['XYZZY'] = 888 @@ -1591,7 +1591,7 @@ def exists(env): assert isinstance(result, CLVar), repr(result) assert result == ['foo', 'bar'], result - class C: + class C(object): def __init__(self, name): self.name = name def __str__(self): @@ -1742,7 +1742,7 @@ def exists(env): # Ensure that lists and dictionaries are # deep copied, but not instances. - class TestA: + class TestA(object): pass env1 = self.TestEnvironment(XXX=TestA(), YYY = [ 1, 2, 3 ], ZZZ = { 1:2, 3:4 }) @@ -1978,7 +1978,7 @@ def generate(env): RPATH=[]) orig_backtick = env.backtick - class my_backtick: + class my_backtick(object): def __init__(self, save_command, output): self.save_command = save_command self.output = output @@ -2671,7 +2671,7 @@ def generate(env): def test_VariantDir(self): """Test the VariantDir() method""" - class MyFS: + class MyFS(object): def Dir(self, name): return name def VariantDir(self, variant_dir, src_dir, duplicate): @@ -2859,7 +2859,7 @@ def generate(env): def test_Dir(self): """Test the Dir() method""" - class MyFS: + class MyFS(object): def Dir(self, name): return 'Dir(%s)' % name @@ -2922,7 +2922,7 @@ def generate(env): def test_Execute(self): """Test the Execute() method""" - class MyAction: + class MyAction(object): def __init__(self, *args, **kw): self.args = args def __call__(self, target, source, env): @@ -2936,7 +2936,7 @@ def generate(env): def test_Entry(self): """Test the Entry() method""" - class MyFS: + class MyFS(object): def Entry(self, name): return 'Entry(%s)' % name @@ -2960,7 +2960,7 @@ def generate(env): def test_File(self): """Test the File() method""" - class MyFS: + class MyFS(object): def File(self, name): return 'File(%s)' % name @@ -3085,7 +3085,7 @@ def generate(env): def test_Repository(self): """Test the Repository() method.""" - class MyFS: + class MyFS(object): def __init__(self): self.list = [] def Repository(self, *dirs): @@ -3123,7 +3123,7 @@ def generate(env): """Test the SConsignFile() method""" import SCons.SConsign - class MyFS: + class MyFS(object): SConstruct_dir = os.sep + 'dir' env = self.TestEnvironment(FOO = 'SConsign', diff --git a/src/engine/SCons/ExecutorTests.py b/src/engine/SCons/ExecutorTests.py index 8e06742..6268984 100644 --- a/src/engine/SCons/ExecutorTests.py +++ b/src/engine/SCons/ExecutorTests.py @@ -29,7 +29,7 @@ import unittest import SCons.Executor -class MyEnvironment: +class MyEnvironment(object): def __init__(self, **kw): self._dict = {} self._dict.update(kw) @@ -42,7 +42,7 @@ class MyEnvironment: def _update(self, dict): self._dict.update(dict) -class MyAction: +class MyAction(object): def __init__(self, actions=['action1', 'action2']): self.actions = actions def __call__(self, target, source, env, **kw): @@ -55,13 +55,13 @@ class MyAction: def get_implicit_deps(self, target, source, env): return [] -class MyBuilder: +class MyBuilder(object): def __init__(self, env, overrides): self.env = env self.overrides = overrides self.action = MyAction() -class MyNode: +class MyNode(object): def __init__(self, name=None, pre=[], post=[]): self.name = name self.implicit = [] @@ -92,7 +92,7 @@ class MyNode: def disambiguate(self): return self -class MyScanner: +class MyScanner(object): def __init__(self, prefix): self.prefix = prefix def path(self, env, cwd, target, source): @@ -181,7 +181,7 @@ class ExecutorTestCase(unittest.TestCase): [t], ['s1', 's2']) - class LocalScanner: + class LocalScanner(object): def path(self, env, dir, target, source): target = list(map(str, target)) source = list(map(str, source)) diff --git a/src/engine/SCons/JobTests.py b/src/engine/SCons/JobTests.py index 4382e4a..e92bdbe 100644 --- a/src/engine/SCons/JobTests.py +++ b/src/engine/SCons/JobTests.py @@ -38,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 @@ -46,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): @@ -112,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): @@ -150,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): @@ -367,7 +367,7 @@ import SCons.Taskmaster import SCons.Node import time -class DummyNodeInfo: +class DummyNodeInfo(object): def update(self, obj): pass diff --git a/src/engine/SCons/MemoizeTests.py b/src/engine/SCons/MemoizeTests.py index ea2096c..9876c27 100644 --- a/src/engine/SCons/MemoizeTests.py +++ b/src/engine/SCons/MemoizeTests.py @@ -30,7 +30,7 @@ import SCons.Memoize -class FakeObject: +class FakeObject(object): __metaclass__ = SCons.Memoize.Memoized_Metaclass @@ -85,7 +85,7 @@ class FakeObject: return mc return None -class Returner: +class Returner(object): def __init__(self, result): self.result = result self.calls = 0 diff --git a/src/engine/SCons/Node/AliasTests.py b/src/engine/SCons/Node/AliasTests.py index 6931072..b0efea7 100644 --- a/src/engine/SCons/Node/AliasTests.py +++ b/src/engine/SCons/Node/AliasTests.py @@ -51,7 +51,7 @@ class AliasTestCase(unittest.TestCase): def test_get_contents(self): """Test the get_contents() method """ - class DummyNode: + class DummyNode(object): def __init__(self, contents): self.contents = contents def get_csig(self): diff --git a/src/engine/SCons/Node/NodeTests.py b/src/engine/SCons/Node/NodeTests.py index db699d3..a301654 100644 --- a/src/engine/SCons/Node/NodeTests.py +++ b/src/engine/SCons/Node/NodeTests.py @@ -55,7 +55,7 @@ def _actionAppend(a1, a2): raise Exception('Cannot Combine Actions') return MyListAction(all) -class MyActionBase: +class MyActionBase(object): def __add__(self, other): return _actionAppend(self, other) @@ -82,7 +82,7 @@ class MyAction(MyActionBase): def get_implicit_deps(self, target, source, env): return [] -class MyExecutor: +class MyExecutor(object): def __init__(self, env=None, targets=[], sources=[]): self.env = env self.targets = targets @@ -113,7 +113,7 @@ class MyListAction(MyActionBase): for A in self.list: A(target, source, env) -class Environment: +class Environment(object): def __init__(self, **kw): self._dict = {} self._dict.update(kw) @@ -132,7 +132,7 @@ class Environment: def get_scanner(self, scanner_key): return self._dict['SCANNERS'][0] -class Builder: +class Builder(object): def __init__(self, env=None, is_explicit=1): if env is None: env = Environment() self.env = env @@ -166,19 +166,19 @@ class ListBuilder(Builder): target = self.nodes[0] self.status = Builder.execute(self, target, source, env) -class FailBuilder: +class FailBuilder(object): def execute(self, target, source, env): return 1 -class ExceptBuilder: +class ExceptBuilder(object): def execute(self, target, source, env): raise SCons.Errors.BuildError -class ExceptBuilder2: +class ExceptBuilder2(object): def execute(self, target, source, env): raise Exception("foo") -class Scanner: +class Scanner(object): called = None def __call__(self, node): self.called = 1 @@ -204,10 +204,10 @@ class MyNode(SCons.Node.Node): def get_found_includes(self, env, scanner, target): return scanner(self) -class Calculator: +class Calculator(object): def __init__(self, val): self.max_drift = 0 - class M: + class M(object): def __init__(self, val): self.val = val def signature(self, args): @@ -384,7 +384,7 @@ class NodeTestCase(unittest.TestCase): else: self.fail("did not catch expected AttributeError") - class Builder: + class Builder(object): action = 'act' env = 'env1' overrides = {} @@ -618,7 +618,7 @@ class NodeTestCase(unittest.TestCase): class testNode2(SCons.Node.Node): def __str__(self): return 'null_binfo' - class FS: + class FS(object): pass node = testNode2() node.fs = FS() @@ -627,8 +627,8 @@ class NodeTestCase(unittest.TestCase): assert result is None, result def get_null_info(): - class Null_SConsignEntry: - class Null_BuildInfo: + class Null_SConsignEntry(object): + class Null_BuildInfo(object): def prepare_dependencies(self): pass binfo = Null_BuildInfo() diff --git a/src/engine/SCons/Node/PythonTests.py b/src/engine/SCons/Node/PythonTests.py index 74a9c99..8b08c52 100644 --- a/src/engine/SCons/Node/PythonTests.py +++ b/src/engine/SCons/Node/PythonTests.py @@ -51,7 +51,7 @@ class ValueTestCase(unittest.TestCase): def test_build(self): """Test "building" a Value Node """ - class fake_executor: + class fake_executor(object): def __call__(self, node): node.write('faked') diff --git a/src/engine/SCons/PathListTests.py b/src/engine/SCons/PathListTests.py index 31a9ec6..212c761 100644 --- a/src/engine/SCons/PathListTests.py +++ b/src/engine/SCons/PathListTests.py @@ -33,7 +33,7 @@ class subst_pathTestCase(unittest.TestCase): def setUp(self): - class FakeEnvironment: + class FakeEnvironment(object): def __init__(self, **kw): self.kw = kw def subst(self, s, target=None, source=None, conv=lambda x: x): @@ -55,7 +55,7 @@ class subst_pathTestCase(unittest.TestCase): import SCons.Node - class A: + class A(object): pass n = SCons.Node.Node() @@ -70,7 +70,7 @@ class subst_pathTestCase(unittest.TestCase): """Test the subst_path() method on a non-Node object """ - class A: + class A(object): def __str__(self): return '<object A>' @@ -86,7 +86,7 @@ class subst_pathTestCase(unittest.TestCase): """Test the subst_path() method on an object with a get() method """ - class B: + class B(object): def get(self): return 'b' diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py index 2b2380d..b05c4cc 100644 --- a/src/engine/SCons/SConfTests.py +++ b/src/engine/SCons/SConfTests.py @@ -175,7 +175,7 @@ class SConfTestCase(unittest.TestCase): self.prefix = '' self.suffix = '' def __call__(self, env, target, source): - class MyNode: + class MyNode(object): def __init__(self, name): self.name = name self.state = None @@ -222,7 +222,7 @@ class SConfTestCase(unittest.TestCase): def do_not_store_info(self): pass def get_executor(self): - class Executor: + class Executor(object): def __init__(self, targets): self.targets = targets def get_all_targets(self): diff --git a/src/engine/SCons/SConsignTests.py b/src/engine/SCons/SConsignTests.py index c7f560e..ec063c2 100644 --- a/src/engine/SCons/SConsignTests.py +++ b/src/engine/SCons/SConsignTests.py @@ -32,11 +32,11 @@ import SCons.dblite import SCons.SConsign -class BuildInfo: +class BuildInfo(object): def merge(self, object): pass -class DummySConsignEntry: +class DummySConsignEntry(object): def __init__(self, name): self.name = name self.binfo = BuildInfo() @@ -45,12 +45,12 @@ class DummySConsignEntry: def convert_from_sconsign(self, dir, name): self.c_from_s = 1 -class FS: +class FS(object): def __init__(self, top): self.Top = top self.Top.repositories = [] -class DummyNode: +class DummyNode(object): def __init__(self, path='not_a_valid_path', binfo=None): self.path = path self.tpath = path @@ -309,7 +309,7 @@ class SConsignFileTestCase(SConsignTestCase): assert SCons.SConsign.DB_Name is file, SCons.SConsign.DB_Name assert SCons.SConsign.DB_Module is None, SCons.SConsign.DB_Module - class Fake_DBM: + class Fake_DBM(object): def open(self, name, mode): self.name = name self.mode = mode @@ -343,7 +343,7 @@ class writeTestCase(SConsignTestCase): test = self.test file = test.workpath('sconsign_file') - class Fake_DBM: + class Fake_DBM(object): def __getitem__(self, key): return None def __setitem__(self, key, value): diff --git a/src/engine/SCons/Scanner/CTests.py b/src/engine/SCons/Scanner/CTests.py index 34e3163..5523f10 100644 --- a/src/engine/SCons/Scanner/CTests.py +++ b/src/engine/SCons/Scanner/CTests.py @@ -320,7 +320,7 @@ class CScannerTestCase9(unittest.TestCase): def runTest(self): """Generate a warning when we can't find a #included file""" SCons.Warnings.enableWarningClass(SCons.Warnings.DependencyWarning) - class TestOut: + class TestOut(object): def __call__(self, x): self.out = x diff --git a/src/engine/SCons/Scanner/DirTests.py b/src/engine/SCons/Scanner/DirTests.py index 1e45e26..968d5d3 100644 --- a/src/engine/SCons/Scanner/DirTests.py +++ b/src/engine/SCons/Scanner/DirTests.py @@ -41,7 +41,7 @@ import SCons.Scanner.Dir # def Entry(self, name): # return self.fs.Entry(name) -class DummyEnvironment: +class DummyEnvironment(object): def __init__(self, root): self.fs = SCons.Node.FS.FS(root) def Dir(self, name): diff --git a/src/engine/SCons/Scanner/FortranTests.py b/src/engine/SCons/Scanner/FortranTests.py index 9ebe2e6..3388ffc 100644 --- a/src/engine/SCons/Scanner/FortranTests.py +++ b/src/engine/SCons/Scanner/FortranTests.py @@ -207,7 +207,7 @@ test.write(['modules', 'use.mod'], "\n") # define some helpers: -class DummyEnvironment: +class DummyEnvironment(object): def __init__(self, listCppPath): self.path = listCppPath self.fs = SCons.Node.FS.FS(test.workpath('')) @@ -390,7 +390,7 @@ class FortranScannerTestCase10(unittest.TestCase): class FortranScannerTestCase11(unittest.TestCase): def runTest(self): SCons.Warnings.enableWarningClass(SCons.Warnings.DependencyWarning) - class TestOut: + class TestOut(object): def __call__(self, x): self.out = x diff --git a/src/engine/SCons/Scanner/IDLTests.py b/src/engine/SCons/Scanner/IDLTests.py index 54b2373..c696722 100644 --- a/src/engine/SCons/Scanner/IDLTests.py +++ b/src/engine/SCons/Scanner/IDLTests.py @@ -186,7 +186,7 @@ test.write([ 'repository', 'src', 'ddd.idl'], "\n") # define some helpers: -class DummyEnvironment: +class DummyEnvironment(object): def __init__(self, listCppPath): self.path = listCppPath self.fs = SCons.Node.FS.FS(test.workpath('')) @@ -337,7 +337,7 @@ class IDLScannerTestCase7(unittest.TestCase): class IDLScannerTestCase8(unittest.TestCase): def runTest(self): SCons.Warnings.enableWarningClass(SCons.Warnings.DependencyWarning) - class TestOut: + class TestOut(object): def __call__(self, x): self.out = x diff --git a/src/engine/SCons/Scanner/ProgTests.py b/src/engine/SCons/Scanner/ProgTests.py index 2b02c90..411e035 100644 --- a/src/engine/SCons/Scanner/ProgTests.py +++ b/src/engine/SCons/Scanner/ProgTests.py @@ -43,7 +43,7 @@ for h in libs: # define some helpers: -class DummyEnvironment: +class DummyEnvironment(object): def __init__(self, **kw): self._dict = {'LIBSUFFIXES' : '.lib'} self._dict.update(kw) @@ -91,7 +91,7 @@ class DummyEnvironment: def File(self, filename): return self.fs.File(test.workpath(filename)) -class DummyNode: +class DummyNode(object): def __init__(self, name): self.name = name def rexists(self): diff --git a/src/engine/SCons/Scanner/ScannerTests.py b/src/engine/SCons/Scanner/ScannerTests.py index 2e9a72a..ee26922 100644 --- a/src/engine/SCons/Scanner/ScannerTests.py +++ b/src/engine/SCons/Scanner/ScannerTests.py @@ -30,7 +30,7 @@ import unittest import SCons.Scanner -class DummyFS: +class DummyFS(object): def File(self, name): return DummyNode(name) @@ -54,7 +54,7 @@ class DummyEnvironment(collections.UserDict): def get_factory(self, factory): return factory or self.fs.File -class DummyNode: +class DummyNode(object): def __init__(self, name, search_result=()): self.name = name self.search_result = tuple(search_result) @@ -106,7 +106,7 @@ class ScannerTestCase(unittest.TestCase): class BaseTestCase(unittest.TestCase): - class skey_node: + class skey_node(object): def __init__(self, key): self.key = key def scanner_key(self): @@ -338,7 +338,7 @@ class BaseTestCase(unittest.TestCase): assert s == 'xyzzy', s class SelectorTestCase(unittest.TestCase): - class skey_node: + class skey_node(object): def __init__(self, key): self.key = key def scanner_key(self): @@ -397,7 +397,7 @@ class SelectorTestCase(unittest.TestCase): class CurrentTestCase(unittest.TestCase): def test_class(self): """Test the Scanner.Current class""" - class MyNode: + class MyNode(object): def __init__(self): self.called_has_builder = None self.called_is_up_to_date = None @@ -471,7 +471,7 @@ class ClassicTestCase(unittest.TestCase): def test_scan(self): """Test the Scanner.Classic scan() method""" - class MyNode: + class MyNode(object): def __init__(self, name): self.name = name self._rfile = self diff --git a/src/engine/SCons/TaskmasterTests.py b/src/engine/SCons/TaskmasterTests.py index e95e92c..66c6b9c 100644 --- a/src/engine/SCons/TaskmasterTests.py +++ b/src/engine/SCons/TaskmasterTests.py @@ -40,7 +40,7 @@ visited_nodes = [] executed = None scan_called = 0 -class Node: +class Node(object): def __init__(self, name, kids = [], scans = []): self.name = name self.kids = kids @@ -50,7 +50,7 @@ class Node: self.scanner = None self.targets = [self] self.prerequisites = [] - class Builder: + class Builder(object): def targets(self, node): return node.targets self.builder = Builder() @@ -170,7 +170,7 @@ class Node: def get_executor(self): if not hasattr(self, 'executor'): - class Executor: + class Executor(object): def prepare(self): pass def get_action_targets(self): @@ -832,7 +832,7 @@ class TaskmasterTestCase(unittest.TestCase): assert n10.prepared # Make sure we call an Executor's prepare() method. - class ExceptionExecutor: + class ExceptionExecutor(object): def prepare(self): raise Exception("Executor.prepare() exception") def get_all_targets(self): diff --git a/src/engine/SCons/Tool/ToolTests.py b/src/engine/SCons/Tool/ToolTests.py index 723ae56..9595680 100644 --- a/src/engine/SCons/Tool/ToolTests.py +++ b/src/engine/SCons/Tool/ToolTests.py @@ -32,7 +32,7 @@ import SCons.Tool class ToolTestCase(unittest.TestCase): def test_Tool(self): """Test the Tool() function""" - class Environment: + class Environment(object): def __init__(self): self.dict = {} def Detect(self, progs): diff --git a/src/engine/SCons/Tool/msvsTests.py b/src/engine/SCons/Tool/msvsTests.py index 00d4754..5eb2818 100644 --- a/src/engine/SCons/Tool/msvsTests.py +++ b/src/engine/SCons/Tool/msvsTests.py @@ -356,7 +356,7 @@ regdata_cv = r'''[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion] regdata_none = [] -class DummyEnv: +class DummyEnv(object): def __init__(self, dict=None): if dict: self.dict = dict @@ -377,14 +377,14 @@ class DummyEnv: def has_key(self,name): return name in self.dict -class RegKey: +class RegKey(object): """key class for storing an 'open' registry key""" def __init__(self,key): self.key = key # Warning: this is NOT case-insensitive, unlike the Windows registry. # So e.g. HKLM\Software is NOT the same key as HKLM\SOFTWARE. -class RegNode: +class RegNode(object): """node in the dummy registry""" def __init__(self,name): self.valdict = {} @@ -459,7 +459,7 @@ class RegNode: rv = rv + indent + '}\n' return rv -class DummyRegistry: +class DummyRegistry(object): """registry class for storing fake registry attributes""" def __init__(self,data): """parse input data into the fake registry""" diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py index 2d7f3fa..2a89509 100644 --- a/src/engine/SCons/UtilTests.py +++ b/src/engine/SCons/UtilTests.py @@ -41,7 +41,7 @@ try: eval('unicode') except NameError: HasUnicode = False else: HasUnicode = True -class OutBuffer: +class OutBuffer(object): def __init__(self): self.buffer = "" @@ -66,7 +66,7 @@ class UtilTestCase(unittest.TestCase): assert splitext('foo.bar') == ('foo','.bar') assert splitext(os.path.join('foo.bar', 'blat')) == (os.path.join('foo.bar', 'blat'),'') - class Node: + class Node(object): def __init__(self, name, children=[]): self.children = children self.name = name @@ -390,7 +390,7 @@ class UtilTestCase(unittest.TestCase): def test_Proxy(self): """Test generic Proxy class.""" - class Subject: + class Subject(object): def foo(self): return 1 def bar(self): @@ -586,7 +586,7 @@ class UtilTestCase(unittest.TestCase): def test_Selector(self): """Test the Selector class""" - class MyNode: + class MyNode(object): def __init__(self, name): self.name = name self.suffix = os.path.splitext(name)[1] @@ -718,7 +718,7 @@ class MD5TestCase(unittest.TestCase): class NodeListTestCase(unittest.TestCase): def test_simple_attributes(self): """Test simple attributes of a NodeList class""" - class TestClass: + class TestClass(object): def __init__(self, name, child=None): self.child = child self.bar = name @@ -734,7 +734,7 @@ class NodeListTestCase(unittest.TestCase): def test_callable_attributes(self): """Test callable attributes of a NodeList class""" - class TestClass: + class TestClass(object): def __init__(self, name, child=None): self.child = child self.bar = name diff --git a/src/engine/SCons/Variables/VariablesTests.py b/src/engine/SCons/Variables/VariablesTests.py index 6df1571..ad46bd6 100644 --- a/src/engine/SCons/Variables/VariablesTests.py +++ b/src/engine/SCons/Variables/VariablesTests.py @@ -32,7 +32,7 @@ import SCons.Subst import SCons.Warnings -class Environment: +class Environment(object): def __init__(self): self.dict = {} def subst(self, x): @@ -380,7 +380,7 @@ class VariablesTestCase(unittest.TestCase): 'OPT_BOOL_2' : 2}) # Test against some old bugs - class Foo: + class Foo(object): def __init__(self, x): self.x = x def __str__(self): diff --git a/src/engine/SCons/WarningsTests.py b/src/engine/SCons/WarningsTests.py index 92c1419..37cb623 100644 --- a/src/engine/SCons/WarningsTests.py +++ b/src/engine/SCons/WarningsTests.py @@ -27,7 +27,7 @@ import sys import unittest import SCons.Warnings -class TestOutput: +class TestOutput(object): def __call__(self, x): args = x.args[0] if len(args) == 1: |