Rev 4469: Fix test parametrization based on IRC feedback. in file:///home/vila/src/bzr/bugs/206577-send-strict/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Jun 29 09:49:20 BST 2009


At file:///home/vila/src/bzr/bugs/206577-send-strict/

------------------------------------------------------------
revno: 4469
revision-id: v.ladeuil+lp at free.fr-20090629084920-t0sfp4z9dnd496si
parent: v.ladeuil+lp at free.fr-20090626181341-grhq7i0h0gv7xlcb
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 206577-send-strict
timestamp: Mon 2009-06-29 10:49:20 +0200
message:
  Fix test parametrization based on IRC feedback.
  
  * bzrlib/tests/blackbox/test_send.py:
  (load_tests): Switch to name based indirection following IRC chat
  with lifeless, spiv and poolie.
  (TestSendStrictWithChanges._changes_type): Now a string
  (TestSendStrictWithChanges.setUp): Use getattr to call the right
  bound method.
-------------- next part --------------
=== modified file 'bzrlib/tests/blackbox/test_send.py'
--- a/bzrlib/tests/blackbox/test_send.py	2009-06-26 18:13:41 +0000
+++ b/bzrlib/tests/blackbox/test_send.py	2009-06-29 08:49:20 +0000
@@ -39,9 +39,9 @@
                 )))
     changes_scenarios = [
         ('uncommitted',
-         dict(_do_changes= TestSendStrictWithChanges.do_uncommitted_changes)),
+         dict(_changes_type= '_uncommitted_changes')),
         ('pending_merges',
-         dict(_do_changes= TestSendStrictWithChanges.do_pending_merges)),
+         dict(_changes_type= '_pending_merges')),
         ]
     tests.multiply_tests(changes_tests, changes_scenarios, result)
     # No parametrization for the remaining tests
@@ -350,21 +350,18 @@
 
 class TestSendStrictWithChanges(TestSendStrict):
 
-    _do_changes = None # Set by load_tests
+    _changes_type = None # Set by load_tests
 
     def setUp(self):
         super(TestSendStrictWithChanges, self).setUp()
-        # FIXME: The following is a bit ugly, but I don't know how to bind the
-        # method properly, yet I want to define the method to call in
-        # load_tests(). -- vila 20090626
-        self._do_changes(self)
+        getattr(self, self._changes_type)()
 
-    def do_uncommitted_changes(self):
+    def _uncommitted_changes(self):
         self.make_parent_and_local_branches()
         # Make a change without committing it
         self.build_tree_contents([('local/file', 'modified')])
 
-    def do_pending_merges(self):
+    def _pending_merges(self):
         self.make_parent_and_local_branches()
         # Create 'other' branch containing a new file
         other_bzrdir = self.parent_tree.bzrdir.sprout('other')
@@ -372,7 +369,7 @@
         self.build_tree_contents([('other/other-file', 'other')])
         other_tree.add('other-file')
         other_tree.commit('other commit', rev_id='other')
-        # Merge and revert, leabing a pending merge
+        # Merge and revert, leaving a pending merge
         self.local_tree.merge_from_branch(other_tree.branch)
         self.local_tree.revert(filenames=['other-file'], backups=False)
 



More information about the bazaar-commits mailing list