Provide forward compatibility with Python 2.5+

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30351 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3609da38
......@@ -83,12 +83,20 @@ def expectedFailure(func):
return wrapper
class TestCase(unittest.TestCase):
"""We only redefine here the run() method, and add a skipTest()
method.
"""We redefine here the run() method, and add a skipTest() method.
We also provide forward-compatible ._testMethodName and ._testMethodDoc
properties smooth over differences between Python 2.4 and 2.5+.
"""
failureException = AssertionError
if sys.version_info < (2, 5):
# BACK: in Python 2.5, __testMethodName becomes _testMethodName.
# Same for __testMethodDoc
_testMethodName = property(lambda self: self.__testMethodName)
_testMethodDoc = property(lambda self: self.__testMethodDoc)
def run(self, result=None):
import pdb
#pdb.set_trace()
......@@ -112,8 +120,7 @@ class TestCase(unittest.TestCase):
finally:
result.stopTest(self)
return
# BACK: __testMethodName became _testMethodName in 2.7
testMethod = getattr(self, self.__testMethodName)
testMethod = getattr(self, self._testMethodName)
try:
success = False
try:
......
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