summaryrefslogtreecommitdiff
path: root/morphlib/cachekeycomputer_tests.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-12-03 16:50:31 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2012-12-03 16:54:15 +0000
commit342b17b1b676e776405613275ffe2c6ca1c65df8 (patch)
treefe35ba63b4cee64888166e47db157dfa18196bae /morphlib/cachekeycomputer_tests.py
parent8cd95022df4a01a9ffa2f36a4118d0ace8ddbdc0 (diff)
downloadmorph-342b17b1b676e776405613275ffe2c6ca1c65df8.tar.gz
Amend test to not add the same source to the pool twice
The test relied on undesired behaviour, since it would create the same source, since the sha1 is not used in the sourcepool's key. Now it creates a new source pool and replaces the source it is being compared to.
Diffstat (limited to 'morphlib/cachekeycomputer_tests.py')
-rw-r--r--morphlib/cachekeycomputer_tests.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/morphlib/cachekeycomputer_tests.py b/morphlib/cachekeycomputer_tests.py
index 7077a313..d4355172 100644
--- a/morphlib/cachekeycomputer_tests.py
+++ b/morphlib/cachekeycomputer_tests.py
@@ -173,8 +173,13 @@ class CacheKeyComputerTests(unittest.TestCase):
new_source = morphlib.source.Source('repo', 'original/ref', 'newsha',
'tree', morphology,
old_artifact.source.filename)
- self.source_pool.add(new_source)
- artifacts = self.artifact_resolver.resolve_artifacts(self.source_pool)
+ sp = morphlib.sourcepool.SourcePool()
+ for source in self.source_pool:
+ if source == old_artifact.source:
+ sp.add(new_source)
+ else:
+ sp.add(source)
+ artifacts = self.artifact_resolver.resolve_artifacts(sp)
for new_artifact in artifacts:
if new_artifact.source == new_source:
break