[Python-checkins] r72812 - in python/trunk/Lib: test/test_unittest.py unittest.py

michael.foord python-checkins at python.org
Fri May 22 00:57:12 CEST 2009


Author: michael.foord
Date: Fri May 22 00:57:02 2009
New Revision: 72812

Log:
Rename TestCase._result to _resultForDoCleanups to avoid potential clashes in TestCase subclasses. Issue 6072.

Modified:
   python/trunk/Lib/test/test_unittest.py
   python/trunk/Lib/unittest.py

Modified: python/trunk/Lib/test/test_unittest.py
==============================================================================
--- python/trunk/Lib/test/test_unittest.py	(original)
+++ python/trunk/Lib/test/test_unittest.py	Fri May 22 00:57:02 2009
@@ -3203,7 +3203,7 @@
 
         result = MockResult()
         test = TestableTest('testNothing')
-        test._result = result
+        test._resultForDoCleanups = result
 
         exc1 = Exception('foo')
         exc2 = Exception('bar')

Modified: python/trunk/Lib/unittest.py
==============================================================================
--- python/trunk/Lib/unittest.py	(original)
+++ python/trunk/Lib/unittest.py	Fri May 22 00:57:02 2009
@@ -352,7 +352,7 @@
            not have a method with the specified name.
         """
         self._testMethodName = methodName
-        self._result = None
+        self._resultForDoCleanups = None
         try:
             testMethod = getattr(self, methodName)
         except AttributeError:
@@ -456,7 +456,7 @@
             if startTestRun is not None:
                 startTestRun()
 
-        self._result = result
+        self._resultForDoCleanups = result
         result.startTest(self)
         testMethod = getattr(self, self._testMethodName)
         try:
@@ -503,7 +503,7 @@
     def doCleanups(self):
         """Execute all cleanup functions. Normally called for you after
         tearDown."""
-        result = self._result
+        result = self._resultForDoCleanups
         ok = True
         while self._cleanups:
             function, args, kwargs = self._cleanups.pop(-1)


More information about the Python-checkins mailing list