Skip to content
Snippets Groups Projects
Commit 8664a7e7b789 authored by Serhiy Storchaka's avatar Serhiy Storchaka
Browse files

Support builds without cStringIO.

The cStringIO module is optional. Fall back to StringIO if it
is not available.
parent cf2935b3dfbd
No related branches found
No related tags found
No related merge requests found
......@@ -5,8 +5,11 @@
PY3 = False
def b(s):
return s
import cStringIO as StringIO
StringIO = BytesIO = StringIO.StringIO
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
BytesIO = StringIO
text_type = unicode
binary_type = str
string_types = (basestring,)
......@@ -21,9 +24,7 @@
from imp import reload as reload_module
def b(s):
return bytes(s, 'latin1')
import io
StringIO = io.StringIO
BytesIO = io.BytesIO
from io import StringIO, BytesIO
text_type = str
binary_type = bytes
string_types = (str,)
......
from __future__ import absolute_import
import unittest
import doctest
import sys
import os
......@@ -28,6 +27,13 @@
import simplejson.decoder
if suite is None:
suite = unittest.TestSuite()
try:
import doctest
except ImportError:
if sys.version_info < (2, 7):
# doctests in 2.6 depends on cStringIO
return suite
raise
for mod in (simplejson, simplejson.encoder, simplejson.decoder):
suite.addTest(doctest.DocTestSuite(mod))
suite.addTest(doctest.DocFileSuite('../../index.rst'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment