summaryrefslogtreecommitdiff
path: root/src/zope/tal/runtest.py
diff options
context:
space:
mode:
authorMarius Gedminas <marius@gedmin.as>2013-02-07 23:04:56 +0000
committerMarius Gedminas <marius@gedmin.as>2013-02-07 23:04:56 +0000
commitcec5452b6cb93ed0d0139be1d01aa660e14b3bbb (patch)
treed1e4eed56d64c239e1a9f80a01f47480a18c6f06 /src/zope/tal/runtest.py
parent040631594cdcf3edb55e35e80bb0b6ef1ba66921 (diff)
downloadzope-tal-cec5452b6cb93ed0d0139be1d01aa660e14b3bbb.tar.gz
Towards Py3K: use io.StringIO
While Python 2.6+ also has io.StringIO(), using it causes numerous test failures -- because io.StringIO() insists on unicode, and our tests are full of (ASCII-only) native string literals. For this reason I decided to keep using StringIO.StringIO or cStringIO.StringIO on Python 2.x.
Diffstat (limited to 'src/zope/tal/runtest.py')
-rw-r--r--src/zope/tal/runtest.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/zope/tal/runtest.py b/src/zope/tal/runtest.py
index 5c50e52..fb002b8 100644
--- a/src/zope/tal/runtest.py
+++ b/src/zope/tal/runtest.py
@@ -23,7 +23,12 @@ import sys
import traceback
import difflib
-from cStringIO import StringIO
+try:
+ # Python 2.x
+ from cStringIO import StringIO
+except ImportError:
+ # Python 3.x
+ from io import StringIO
if __name__ == "__main__":
from . import setpath # Local hack to tweak sys.path etc.