~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2013-05-19 13:38:07 UTC
  • mfrom: (6015.57.4 2.4)
  • mto: (6437.63.10 2.5)
  • mto: This revision was merged to the branch mainline in revision 6575.
  • Revision ID: john@arbash-meinel.com-20130519133807-69kfoe85gw2va4y2
Try merging 2.4 into 2.5 and resolving the conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1782
1782
 
1783
1783
        :returns: The actual attr value.
1784
1784
        """
1785
 
        value = getattr(obj, attr_name)
1786
1785
        # The actual value is captured by the call below
1787
 
        self.addCleanup(setattr, obj, attr_name, value)
 
1786
        value = getattr(obj, attr_name, _unitialized_attr)
 
1787
        if value is _unitialized_attr:
 
1788
            # When the test completes, the attribute should not exist, but if
 
1789
            # we aren't setting a value, we don't need to do anything.
 
1790
            if new is not _unitialized_attr:
 
1791
                self.addCleanup(delattr, obj, attr_name)
 
1792
        else:
 
1793
            self.addCleanup(setattr, obj, attr_name, value)
1788
1794
        if new is not _unitialized_attr:
1789
1795
            setattr(obj, attr_name, new)
1790
1796
        return value