a few Py3k fixes in runtests.py
authorLisandro Dalcin <dalcinl@gmail.com>
Thu, 8 Oct 2009 23:30:07 +0000 (20:30 -0300)
committerLisandro Dalcin <dalcinl@gmail.com>
Thu, 8 Oct 2009 23:30:07 +0000 (20:30 -0300)
runtests.py

index f5e53405b46276f46da12ac263da691666d2bc19..4323dcc390a9d711855e87268bd495d07baec514 100644 (file)
@@ -8,7 +8,10 @@ import shutil
 import unittest
 import doctest
 import operator
-from StringIO import StringIO
+try:
+    from StringIO import StringIO
+except ImportError:
+    from io import StringIO
 
 try:
     import cPickle as pickle
@@ -394,7 +397,7 @@ class CythonRunTestCase(CythonCompileTestCase):
                 try:
                     partial_result = PartialTestResult(result)
                     doctest.DocTestSuite(module_name).run(partial_result)
-                except Exception, e:
+                except Exception:
                     partial_result.addError(module_name, sys.exc_info())
                     result_code = 1
                 pickle.dump(partial_result.data(), output)