~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-23 10:04:17 UTC
  • mfrom: (6437.63.11 2.5)
  • mto: This revision was merged to the branch mainline in revision 6575.
  • Revision ID: john@arbash-meinel.com-20130523100417-i38zikta14q2xdyz
Merge lp:bzr/2.5 tip and move up the changelog items.

Show diffs side-by-side

added added

removed removed

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