summaryrefslogtreecommitdiff
path: root/morphlib/builder2_tests.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-06-14 12:50:20 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2012-06-14 12:50:20 +0000
commit34b5ccb6bf00e0b6fa67e75eb749a32dd9fed277 (patch)
tree4a08f0c68c065e5f709a7eb325c687fbe8e3dce6 /morphlib/builder2_tests.py
parent18a3b4dbf2fabf46cca6f163ec949d22437ee966 (diff)
downloadmorph-34b5ccb6bf00e0b6fa67e75eb749a32dd9fed277.tar.gz
morphlib.builder2: fix unit tests
Diffstat (limited to 'morphlib/builder2_tests.py')
-rw-r--r--morphlib/builder2_tests.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/morphlib/builder2_tests.py b/morphlib/builder2_tests.py
index 9730b59e..5a86fe75 100644
--- a/morphlib/builder2_tests.py
+++ b/morphlib/builder2_tests.py
@@ -80,9 +80,15 @@ class FakeFileHandle(object):
def __enter__(self):
return self
- def __exit__(self, type, value, traceback):
+ def _writeback(self):
self._cache._cached[self._key] = self._string
+ def __exit__(self, type, value, traceback):
+ self._writeback()
+
+ def close(self):
+ self._writeback()
+
def write(self, string):
self._string += string
@@ -209,6 +215,18 @@ class BuilderBaseTests(unittest.TestCase):
self.assertEqual(sorted(events),
sorted(meta['build-times'].keys()))
+ def test_downloads_depends(self):
+ lac = FakeArtifactCache()
+ rac = FakeArtifactCache()
+ afacts = [FakeArtifact(name) for name in ('a', 'b', 'c')]
+ for a in afacts:
+ fh = rac.put(a)
+ fh.write(a.name)
+ fh.close()
+ morphlib.builder2.download_depends(afacts, lac, rac)
+ self.assertTrue(all(lac.has(a) for a in afacts))
+
+
class ChunkBuilderTests(unittest.TestCase):
def setUp(self):