Rev 4326: (mwhudson) keep _TestCase__testMethodDoc, save attrs more sanely in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon May 4 23:12:07 BST 2009


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

------------------------------------------------------------
revno: 4326
revision-id: pqm at pqm.ubuntu.com-20090504221201-uh3mfp83o2m0ts7n
parent: pqm at pqm.ubuntu.com-20090504033314-7mfh3y311028dk2m
parent: michael.hudson at canonical.com-20090430040138-w0cw99i003rqfls1
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2009-05-04 23:12:01 +0100
message:
  (mwhudson) keep _TestCase__testMethodDoc, save attrs more sanely
modified:
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
    ------------------------------------------------------------
    revno: 4313.1.1
    revision-id: michael.hudson at canonical.com-20090430040138-w0cw99i003rqfls1
    parent: pqm at pqm.ubuntu.com-20090429222437-n7rzr4tmlyl4jpiu
    committer: Michael Hudson <michael.hudson at canonical.com>
    branch nick: preserve-testMethodDoc-with-unittest-2.4
    timestamp: Thu 2009-04-30 16:01:38 +1200
    message:
      add _TestCase__testMethodDoc to attrs_to_keep, do attr saving more sanelyb
    modified:
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-05-01 03:50:47 +0000
+++ b/bzrlib/tests/__init__.py	2009-05-04 22:12:01 +0000
@@ -782,7 +782,7 @@
     _gather_lsprof_in_benchmarks = False
     attrs_to_keep = ('id', '_testMethodName', '_testMethodDoc',
                      '_log_contents', '_log_file_name', '_benchtime',
-                     '_TestCase__testMethodName')
+                     '_TestCase__testMethodName', '_TestCase__testMethodDoc',)
 
     def __init__(self, methodName='testMethod'):
         super(TestCase, self).__init__(methodName)
@@ -1446,11 +1446,9 @@
                 raise
         finally:
             saved_attrs = {}
-            absent_attr = object()
             for attr_name in self.attrs_to_keep:
-                attr = getattr(self, attr_name, absent_attr)
-                if attr is not absent_attr:
-                    saved_attrs[attr_name] = attr
+                if attr_name in self.__dict__:
+                    saved_attrs[attr_name] = self.__dict__[attr_name]
             self.__dict__ = saved_attrs
 
     def tearDown(self):




More information about the bazaar-commits mailing list