summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/ExecutorTests.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-12-29 21:04:56 (GMT)
committerSteven Knight <knight@baldmt.com>2004-12-29 21:04:56 (GMT)
commitf30bc35b4edccf597b5cd4474ea6b089f9cdc30c (patch)
tree12b6722f049211b37574477e82ab5c49a0521052 /src/engine/SCons/ExecutorTests.py
parentb60cfbedd5f09842e6a9429711841a04cf404ef4 (diff)
downloadSCons-f30bc35b4edccf597b5cd4474ea6b089f9cdc30c.zip
SCons-f30bc35b4edccf597b5cd4474ea6b089f9cdc30c.tar.gz
SCons-f30bc35b4edccf597b5cd4474ea6b089f9cdc30c.tar.bz2
Add a Memoizer metaclass to collect the logic for caching values in one location. Convert by-hand caching to use of Memoizer. (Kevin Quick)
Diffstat (limited to 'src/engine/SCons/ExecutorTests.py')
-rw-r--r--src/engine/SCons/ExecutorTests.py30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/engine/SCons/ExecutorTests.py b/src/engine/SCons/ExecutorTests.py
index 219efee..d5b6dd2 100644
--- a/src/engine/SCons/ExecutorTests.py
+++ b/src/engine/SCons/ExecutorTests.py
@@ -96,10 +96,11 @@ class ExecutorTestCase(unittest.TestCase):
def test_get_build_env(self):
"""Test fetching and generating a build environment"""
- x = SCons.Executor.Executor(MyAction(), 'e', [], 't', ['s1', 's2'])
- x.build_env = 'eee'
+ x = SCons.Executor.Executor(MyAction(), MyEnvironment(e=1), [],
+ 't', ['s1', 's2'])
+ x.env = MyEnvironment(eee=1)
be = x.get_build_env()
- assert be == 'eee', be
+ assert be['eee'] == 1, be
env = MyEnvironment(X='xxx')
x = SCons.Executor.Executor(MyAction(),
@@ -171,17 +172,23 @@ class ExecutorTestCase(unittest.TestCase):
def test_cleanup(self):
"""Test cleaning up an Executor"""
- x = SCons.Executor.Executor('b', 'e', 'o', 't', ['s1', 's2'])
+ orig_env = MyEnvironment(e=1)
+ x = SCons.Executor.Executor('b', orig_env, [{'o':1}],
+ 't', ['s1', 's2'])
+ be = x.get_build_env()
+ assert be['e'] == 1, be['e']
+
x.cleanup()
- x.build_env = 'eee'
+ x.env = MyEnvironment(eee=1)
be = x.get_build_env()
- assert be == 'eee', be
+ assert be['eee'] == 1, be['eee']
x.cleanup()
- assert not hasattr(x, 'build_env')
+ be = x.get_build_env()
+ assert be['eee'] == 1, be['eee']
def test_add_sources(self):
"""Test adding sources to an Executor"""
@@ -220,6 +227,7 @@ class ExecutorTestCase(unittest.TestCase):
del result[:]
x.nullify()
+ assert result == [], result
x(MyNode([], []), None)
assert result == [], result
s = str(x)
@@ -230,13 +238,13 @@ class ExecutorTestCase(unittest.TestCase):
env = MyEnvironment(C='contents')
x = SCons.Executor.Executor(MyAction(), env, [], ['t'], ['s'])
- x.contents = 'contents'
c = x.get_contents()
- assert c == 'contents', c
+ assert c == 'action1 action2 t s', c
- x = SCons.Executor.Executor(MyAction(), env, [], ['t'], ['s'])
+ x = SCons.Executor.Executor(MyAction(actions=['grow']), env, [],
+ ['t'], ['s'])
c = x.get_contents()
- assert c == 'action1 action2 t s', c
+ assert c == 'grow t s', c
def test_get_timestamp(self):
"""Test fetching the "timestamp" """