summaryrefslogtreecommitdiff
path: root/morphlib/morphology_tests.py
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-01-31 16:38:18 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-01-31 16:42:41 +0000
commitc2104eb199916f9ef7e7b77d0eebf33619ed3ea9 (patch)
tree01eb904eda1461bf70ecf97aa8f6445d0bbfbb07 /morphlib/morphology_tests.py
parentab965be42d10f2608dc883ee0cc34a1cd0fe5058 (diff)
downloadmorph-c2104eb199916f9ef7e7b77d0eebf33619ed3ea9.tar.gz
Properly unpack dependencies into the staging area in build-single.
This requires build-single to take a dependency context tuple when building chunks of a stratum. This context tuple is the surrounding stratum which is used to construct the dependency graph in the worker and then do a breadth-first search to collect all dependencies that need to be added to the staging area. Implementing this required a few hash/eq changes in Blob, Morphology and Treeish as well as a few adjustments in the corresponding unit tests.
Diffstat (limited to 'morphlib/morphology_tests.py')
-rw-r--r--morphlib/morphology_tests.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/morphlib/morphology_tests.py b/morphlib/morphology_tests.py
index 54cdbb18..575aaeec 100644
--- a/morphlib/morphology_tests.py
+++ b/morphlib/morphology_tests.py
@@ -172,3 +172,35 @@ class MorphologyTests(unittest.TestCase):
self.assertEqual(morph.disk_size, '1G')
self.assertEqual(morph.strata, ['foo', 'bar'])
self.assertEqual(morph.test_stories, ['test-1', 'test-2'])
+
+ def test_hashing_and_equality_checks(self):
+ mockfile1 = MockFile('''
+ {
+ "name": "foo",
+ "kind": "chunk"
+ }''')
+ mockfile1.name = 'mockfile1'
+ mockfile2 = MockFile('''
+ {
+ "name": "foo",
+ "kind": "chunk"
+ }''')
+ mockfile2.name = 'mockfile1'
+ mockfile3 = MockFile('''
+ {
+ "name": "bar",
+ "kind": "chunk"
+ }''')
+ mockfile3.name = 'mockfile2'
+
+ treeish = FakeTreeish()
+
+ morph1 = morphlib.morphology.Morphology(treeish, mockfile1)
+ morph2 = morphlib.morphology.Morphology(treeish, mockfile2)
+ morph3 = morphlib.morphology.Morphology(treeish, mockfile3)
+
+ self.assertEqual(hash(morph1), hash(morph2))
+ self.assertEqual(morph1, morph2)
+
+ self.assertNotEqual(hash(morph1), hash(morph3))
+ self.assertNotEqual(morph1, morph3)