[MERGE] code cleanups for bzrdir.py

Martin Pool mbp at canonical.com
Tue Sep 25 03:07:26 BST 2007


Martin Pool has voted tweak.
Status is now: Conditionally approved
Comment:


  At format 7 this was split out into Branch, Repository and Checkout 
control
  directories.
+
+Note: This module has a lot of ``open`` functions/methods that return
+references to in-memory objects. As a rule, there are no matching 
``close``
+methods. To free any associated resources, simply stop referencing the
+objects returned.
  """

(comment) This kind of commentary probably now fits better into the 
developer guide than the docstrings.


+        try:
+            bd.retire_bzrdir(limit=0)
+        except Exception, ex:
+            self.assertSubset([ex.__class__],
+                [errors.FileExists, errors.DirectoryNotEmpty])
+        else:
+            self.fail("exception expected but not thrown")
+

(tweak) I believe you could more simply write this as

   self.assertRaises((errors.FileExists, errors.DirectoryNotEmpty),
         bd.retire_bzrdir, limit=0)

The change in exception reporting is what I wanted, thanks.

For details, see: 
http://bundlebuggy.aaronbentley.com/request/%3C46F37CF0.4020300%40internode.on.net%3E



More information about the bazaar mailing list