Rev 1356: fix tests. in http://people.samba.org/bzr/jelmer/bzr-svn/0.4

Jelmer Vernooij jelmer at samba.org
Thu Jun 26 17:28:29 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/0.4

------------------------------------------------------------
revno: 1356
revision-id: jelmer at samba.org-20080626162829-551ec6eiyk8gacqy
parent: jelmer at samba.org-20080626162808-4hzmtuouspyl1eho
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Thu 2008-06-26 18:28:29 +0200
message:
  fix tests.
modified:
  tests/test_branch.py           test_branch.py-20060508162215-74ffeb5d608f8e20
  tests/test_fetch.py            test_fetch.py-20070624210302-luvgwjmlfysk5qeq-1
=== modified file 'tests/test_branch.py'
--- a/tests/test_branch.py	2008-06-26 13:26:06 +0000
+++ b/tests/test_branch.py	2008-06-26 16:28:29 +0000
@@ -509,14 +509,12 @@
         newbranch.lock_read()
         tree = newbranch.repository.revision_tree(oldbranch.generate_revision_id(7))
 
-        weave = newbranch.repository.weave_store.get_weave(
-            tree.inventory.path2id("hosts"),
-            newbranch.repository.get_transaction())
+        host_fileid = tree.inventory.path2id("hosts")
 
-        self.assertEqual(set([
+        self.assertVersionsPresentEquals(newbranch.repository.texts, 
+                                        host_fileid, [
             oldbranch.generate_revision_id(6),
-            oldbranch.generate_revision_id(7)]),
-                          set(weave.versions()))
+            oldbranch.generate_revision_id(7)])
         newbranch.unlock()
  
 
@@ -571,14 +569,17 @@
         texts = newbranch.repository.texts
         host_fileid = tree.inventory.path2id("hosts")
         mapping = BzrSvnMappingv3FileProps(TrunkBranchingScheme())
-        self.assertEqual(set([
-            (host_fileid, mapping.generate_revision_id(uuid, 1, "trunk")),
-            (host_fileid, mapping.generate_revision_id(uuid, 2, "trunk")),
-            (host_fileid, mapping.generate_revision_id(uuid, 3, "trunk")),
-            (host_fileid, oldbranch.generate_revision_id(6))]),
-            set(filter(lambda (fid, rid): fid == host_fileid, texts.keys())))
+        self.assertVersionsPresentEquals(texts, host_fileid, [
+            mapping.generate_revision_id(uuid, 1, "trunk"),
+            mapping.generate_revision_id(uuid, 2, "trunk"),
+            mapping.generate_revision_id(uuid, 3, "trunk"),
+            oldbranch.generate_revision_id(6)])
         newbranch.repository.unlock()
 
+    def assertVersionsPresentEquals(self, texts, fileid, versions):
+        self.assertEqual(set([(fileid, v) for v in versions]),
+            set(filter(lambda (fid, rid): fid == fileid, texts.keys())))
+
     def test_check(self):
         self.make_repository('d')
         branch = Branch.open('d')

=== modified file 'tests/test_fetch.py'
--- a/tests/test_fetch.py	2008-06-26 15:38:43 +0000
+++ b/tests/test_fetch.py	2008-06-26 16:28:29 +0000
@@ -1699,7 +1699,7 @@
             oldrepos.generate_revision_id(2, "", mapping),
             oldrepos.generate_revision_id(3, "", mapping),
             oldrepos.generate_revision_id(4, "", mapping),
-            ]), newrepos.all_revision_ids())
+            ]), set(newrepos.all_revision_ids()))
 
     def test_fetch_property_change_only_trunk(self):
         repos_url = self.make_repository('d')
@@ -1734,7 +1734,7 @@
             oldrepos.generate_revision_id(2, "trunk", mapping),
             oldrepos.generate_revision_id(3, "trunk", mapping),
             oldrepos.generate_revision_id(4, "trunk", mapping),
-            ]), newrepos.all_revision_ids())
+            ]), set(newrepos.all_revision_ids()))
 
     def test_fetch_crosscopy(self):
         repos_url = self.make_client('d', 'dc')




More information about the bazaar-commits mailing list