Rev 5867: (jelmer) Move Tree._get_check_refs-dependent test from in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon May 16 14:42:57 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5867 [merge]
revision-id: pqm at pqm.ubuntu.com-20110516144254-6b0izuhn0nn22qg1
parent: pqm at pqm.ubuntu.com-20110516134958-xkhcnr3lt1tc8ogt
parent: jelmer at samba.org-20110513145818-o2z3dur1tv78px62
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2011-05-16 14:42:54 +0000
message:
  (jelmer) Move Tree._get_check_refs-dependent test from
   bzrlib.tests.per_repository to bzrlib.tests.per_repository_vf. (Jelmer
   Vernooij)
modified:
  bzrlib/tests/per_repository/test_check.py test_check.py-20070824124512-38g4d135gcqxo4zb-1
  bzrlib/tests/per_repository_vf/test_check.py test_check.py-20110419124438-wxrtlhv70k7rxhg3-1
=== modified file 'bzrlib/tests/per_repository/test_check.py'
--- a/bzrlib/tests/per_repository/test_check.py	2011-04-19 12:48:51 +0000
+++ b/bzrlib/tests/per_repository/test_check.py	2011-05-13 14:46:44 +0000
@@ -40,36 +40,6 @@
         self.assertContainsRe(self.get_log(), "0 unreferenced text versions")
 
 
-class TestCallbacks(TestCaseWithRepository):
-
-    def test_callback_tree_and_branch(self):
-        # use a real tree to get actual refs that will work
-        tree = self.make_branch_and_tree('foo')
-        revid = tree.commit('foo')
-        tree.lock_read()
-        self.addCleanup(tree.unlock)
-        needed_refs = {}
-        for ref in tree._get_check_refs():
-            needed_refs.setdefault(ref, []).append(tree)
-        for ref in tree.branch._get_check_refs():
-            needed_refs.setdefault(ref, []).append(tree.branch)
-        self.tree_check = tree._check
-        self.branch_check = tree.branch.check
-        tree._check = self.tree_callback
-        tree.branch.check = self.branch_callback
-        self.callbacks = []
-        tree.branch.repository.check([revid], callback_refs=needed_refs)
-        self.assertNotEqual([], self.callbacks)
-
-    def tree_callback(self, refs):
-        self.callbacks.append(('tree', refs))
-        return self.tree_check(refs)
-
-    def branch_callback(self, refs):
-        self.callbacks.append(('branch', refs))
-        return self.branch_check(refs)
-
-
 class TestCleanRepository(TestCaseWithRepository):
 
     def test_new_repo(self):

=== modified file 'bzrlib/tests/per_repository_vf/test_check.py'
--- a/bzrlib/tests/per_repository_vf/test_check.py	2011-04-19 12:48:51 +0000
+++ b/bzrlib/tests/per_repository_vf/test_check.py	2011-05-13 14:58:18 +0000
@@ -25,6 +25,7 @@
     )
 from bzrlib.tests.scenarios import load_tests_apply_scenarios
 from bzrlib.tests.per_repository_vf import (
+    TestCaseWithRepository,
     all_repository_vf_format_scenarios,
     )
 from bzrlib.tests.per_repository_vf.helpers import (
@@ -84,3 +85,35 @@
             self.get_log(),
             "revision-id has wrong parents in index: "
             r"\('incorrect-parent',\) should be \(\)")
+
+
+class TestCallbacks(TestCaseWithRepository):
+
+    scenarios = all_repository_vf_format_scenarios()
+
+    def test_callback_tree_and_branch(self):
+        # use a real tree to get actual refs that will work
+        tree = self.make_branch_and_tree('foo')
+        revid = tree.commit('foo')
+        tree.lock_read()
+        self.addCleanup(tree.unlock)
+        needed_refs = {}
+        for ref in tree._get_check_refs():
+            needed_refs.setdefault(ref, []).append(tree)
+        for ref in tree.branch._get_check_refs():
+            needed_refs.setdefault(ref, []).append(tree.branch)
+        self.tree_check = tree._check
+        self.branch_check = tree.branch.check
+        tree._check = self.tree_callback
+        tree.branch.check = self.branch_callback
+        self.callbacks = []
+        tree.branch.repository.check([revid], callback_refs=needed_refs)
+        self.assertNotEqual([], self.callbacks)
+
+    def tree_callback(self, refs):
+        self.callbacks.append(('tree', refs))
+        return self.tree_check(refs)
+
+    def branch_callback(self, refs):
+        self.callbacks.append(('branch', refs))
+        return self.branch_check(refs)




More information about the bazaar-commits mailing list