Rev 4066: Python2.4 compatibility. in http://people.ubuntu.com/~robertc/baz2.0/integration

Robert Collins robertc at robertcollins.net
Sun Mar 1 10:47:51 GMT 2009


At http://people.ubuntu.com/~robertc/baz2.0/integration

------------------------------------------------------------
revno: 4066
revision-id: robertc at robertcollins.net-20090301104749-nv3ku2q91konxniy
parent: robertc at robertcollins.net-20090301095707-w52moizbku399auj
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Sun 2009-03-01 21:47:49 +1100
message:
  Python2.4 compatibility.
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-03-01 09:57:07 +0000
+++ b/bzrlib/tests/__init__.py	2009-03-01 10:47:49 +0000
@@ -1304,7 +1304,13 @@
         try:
             try:
                 result.startTest(self)
-                testMethod = getattr(self, self._testMethodName)
+                absent_attr = object()
+                # Python 2.5
+                method_name = getattr(self, '_testMethodName', absent_attr)
+                if method_name is absent_attr:
+                    # Python 2.4
+                    method_name = getattr(self, '_TestCase__testMethodName')
+                testMethod = getattr(self, method_name)
                 try:
                     try:
                         self.setUp()




More information about the bazaar-commits mailing list