Edgewall Software

Ticket #8061: 8061-python-2.3-fixes-r7903.patch

File 8061-python-2.3-fixes-r7903.patch, 2.6 KB (added by rblank, 3 years ago)

First batch of Python 2.3 compatibility fixes

  • trac/admin/tests/console.py

    diff --git a/trac/admin/tests/console.py b/trac/admin/tests/console.py
    a b  
    132132            sys.stderr = _err 
    133133            sys.stdout = _out 
    134134            if expect_exception: 
    135                 tb = traceback.format_exc() 
     135                tb = ''.join(traceback.format_exception(*sys.exc_info())) 
    136136                message = tb.splitlines()[-1] + '\n' 
    137137                return -1, message 
    138138            raise 
  • trac/mimeview/tests/api.py

    diff --git a/trac/mimeview/tests/api.py b/trac/mimeview/tests/api.py
    a b  
    108108        self.assertEqual(Converter2(self.env), conversions[2][-1]) 
    109109 
    110110class GroupLinesTestCase(unittest.TestCase): 
     111     
     112    if not hasattr(unittest.TestCase, "assertTrue"): 
     113        assertTrue = unittest.TestCase.failUnless   # Python 2.3 compatibility 
    111114 
    112115    def test_empty_stream(self): 
    113116        # FIXME: this currently fails 
  • trac/mimeview/tests/patch.py

    diff --git a/trac/mimeview/tests/patch.py b/trac/mimeview/tests/patch.py
    a b  
    2727 
    2828 
    2929class PatchRendererTestCase(unittest.TestCase): 
     30     
     31    if not hasattr(unittest.TestCase, "assertTrue"): 
     32        assertTrue = unittest.TestCase.failUnless   # Python 2.3 compatibility 
    3033 
    3134    def setUp(self): 
    3235        env = EnvironmentStub(enable=[Chrome, PatchRenderer]) 
  • trac/mimeview/tests/pygments.py

    diff --git a/trac/mimeview/tests/pygments.py b/trac/mimeview/tests/pygments.py
    a b  
    3434 
    3535class PygmentsRendererTestCase(unittest.TestCase): 
    3636 
     37    if not hasattr(unittest.TestCase, "assertTrue"): 
     38        assertTrue = unittest.TestCase.failUnless   # Python 2.3 compatibility 
     39 
    3740    def setUp(self): 
    3841        self.env = EnvironmentStub(enable=[Chrome, PygmentsRenderer]) 
    3942        self.pygments = Mimeview(self.env).renderers[0] 
  • trac/test.py

    diff --git a/trac/test.py b/trac/test.py
    a b  
    123123            for test in self._tests: 
    124124                if hasattr(test, 'setFixture'): 
    125125                    test.setFixture(self.fixture) 
    126         unittest.TestSuite.run(self, result) 
     126        for test in self._tests:    # Content of unittest.TestSuite.run() 
     127            if result.shouldStop:   # copied here for Python 2.3 compatibility 
     128                break 
     129            test(result) 
    127130        self.tearDown() 
    128131        return result 
    129132 
     133    def __call__(self, *args, **kwds):      # Python 2.3 compatibility 
     134        return self.run(*args, **kwds) 
     135 
    130136 
    131137class TestCaseSetup(unittest.TestCase): 
    132138    def setFixture(self, fixture):