Kaydet (Commit) a50af069 authored tarafından Michael Foord's avatar Michael Foord

Rename TestCase._result to _resultForDoCleanups to avoid potential clashes in…

Rename TestCase._result to _resultForDoCleanups to avoid potential clashes in TestCase subclasses. Issue 6072.
üst a4e0efa4
...@@ -3203,7 +3203,7 @@ class TestCleanUp(TestCase): ...@@ -3203,7 +3203,7 @@ class TestCleanUp(TestCase):
result = MockResult() result = MockResult()
test = TestableTest('testNothing') test = TestableTest('testNothing')
test._result = result test._resultForDoCleanups = result
exc1 = Exception('foo') exc1 = Exception('foo')
exc2 = Exception('bar') exc2 = Exception('bar')
......
...@@ -352,7 +352,7 @@ class TestCase(object): ...@@ -352,7 +352,7 @@ class TestCase(object):
not have a method with the specified name. not have a method with the specified name.
""" """
self._testMethodName = methodName self._testMethodName = methodName
self._result = None self._resultForDoCleanups = None
try: try:
testMethod = getattr(self, methodName) testMethod = getattr(self, methodName)
except AttributeError: except AttributeError:
...@@ -456,7 +456,7 @@ class TestCase(object): ...@@ -456,7 +456,7 @@ class TestCase(object):
if startTestRun is not None: if startTestRun is not None:
startTestRun() startTestRun()
self._result = result self._resultForDoCleanups = result
result.startTest(self) result.startTest(self)
testMethod = getattr(self, self._testMethodName) testMethod = getattr(self, self._testMethodName)
try: try:
...@@ -503,7 +503,7 @@ class TestCase(object): ...@@ -503,7 +503,7 @@ class TestCase(object):
def doCleanups(self): def doCleanups(self):
"""Execute all cleanup functions. Normally called for you after """Execute all cleanup functions. Normally called for you after
tearDown.""" tearDown."""
result = self._result result = self._resultForDoCleanups
ok = True ok = True
while self._cleanups: while self._cleanups:
function, args, kwargs = self._cleanups.pop(-1) function, args, kwargs = self._cleanups.pop(-1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment