[Erp5-report] r30351 - /erp5/trunk/products/ERP5Type/tests/backportUnittest.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Nov 5 23:38:22 CET 2009
Author: leonardo
Date: Thu Nov 5 23:38:21 2009
New Revision: 30351
URL: http://svn.erp5.org?rev=30351&view=rev
Log:
Provide forward compatibility with Python 2.5+
Modified:
erp5/trunk/products/ERP5Type/tests/backportUnittest.py
Modified: erp5/trunk/products/ERP5Type/tests/backportUnittest.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/backportUnittest.py?rev=30351&r1=30350&r2=30351&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/backportUnittest.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/backportUnittest.py [utf8] Thu Nov 5 23:38:21 2009
@@ -83,11 +83,19 @@
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
@@ -112,8 +120,7 @@
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:
More information about the Erp5-report
mailing list