diff options
author | Bob Ippolito <bob@redivi.com> | 2014-04-30 11:43:21 -0700 |
---|---|---|
committer | Bob Ippolito <bob@redivi.com> | 2014-04-30 11:43:21 -0700 |
commit | 88ac2f35519afb8099dbb7861ff476896d577206 (patch) | |
tree | aa4d5a5c00fafe7b2ed41e78c1f1679a4e90325d | |
parent | 080376336e79d712ba56ba76ad00047b0023d13b (diff) | |
download | simplejson-88ac2f35519afb8099dbb7861ff476896d577206.tar.gz |
fix tests to run on Python 3.4
-rw-r--r-- | CHANGES.txt | 4 | ||||
-rw-r--r-- | conf.py | 2 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | simplejson/__init__.py | 2 | ||||
-rw-r--r-- | simplejson/tests/__init__.py | 82 |
5 files changed, 52 insertions, 40 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 7c432ef..620d51d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +Version 3.4.1 released 2014-04-30 + +* Fixed tests to run on Python 3.4 + Version 3.4.0 released 2014-04-02 * Native setuptools support re-introduced @@ -44,7 +44,7 @@ copyright = '2014, Bob Ippolito' # The short X.Y version. version = '3.4' # The full version, including alpha/beta/rc tags. -release = '3.4.0' +release = '3.4.1' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: @@ -11,7 +11,7 @@ from distutils.errors import CCompilerError, DistutilsExecError, \ DistutilsPlatformError IS_PYPY = hasattr(sys, 'pypy_translation_info') -VERSION = '3.4.0' +VERSION = '3.4.1' DESCRIPTION = "Simple, fast, extensible JSON encoder/decoder for Python" with open('README.rst', 'r') as f: diff --git a/simplejson/__init__.py b/simplejson/__init__.py index 702ddab..ed9c9a8 100644 --- a/simplejson/__init__.py +++ b/simplejson/__init__.py @@ -98,7 +98,7 @@ Using simplejson.tool from the shell to validate and pretty-print:: Expecting property name: line 1 column 3 (char 2) """ from __future__ import absolute_import -__version__ = '3.4.0' +__version__ = '3.4.1' __all__ = [ 'dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONDecodeError', 'JSONEncoder', diff --git a/simplejson/tests/__init__.py b/simplejson/tests/__init__.py index c01dfcb..5490584 100644 --- a/simplejson/tests/__init__.py +++ b/simplejson/tests/__init__.py @@ -3,19 +3,16 @@ import unittest import doctest import sys -class OptionalExtensionTestSuite(unittest.TestSuite): + +class NoExtensionTestSuite(unittest.TestSuite): def run(self, result): import simplejson - run = unittest.TestSuite.run - run(self, result) - if simplejson._import_c_make_encoder() is None: - TestMissingSpeedups().run(result) - else: - simplejson._toggle_speedups(False) - run(self, result) - simplejson._toggle_speedups(True) + simplejson._toggle_speedups(False) + result = unittest.TestSuite.run(self, result) + simplejson._toggle_speedups(True) return result + class TestMissingSpeedups(unittest.TestCase): def runTest(self): if hasattr(sys, 'pypy_translation_info'): @@ -23,6 +20,7 @@ class TestMissingSpeedups(unittest.TestCase): elif hasattr(self, 'skipTest'): self.skipTest('_speedups.so is missing!') + def additional_tests(suite=None): import simplejson import simplejson.encoder @@ -36,34 +34,44 @@ def additional_tests(suite=None): def all_tests_suite(): - suite = unittest.TestLoader().loadTestsFromNames([ - 'simplejson.tests.test_bigint_as_string', - 'simplejson.tests.test_check_circular', - 'simplejson.tests.test_decode', - 'simplejson.tests.test_default', - 'simplejson.tests.test_dump', - 'simplejson.tests.test_encode_basestring_ascii', - 'simplejson.tests.test_encode_for_html', - 'simplejson.tests.test_errors', - 'simplejson.tests.test_fail', - 'simplejson.tests.test_float', - 'simplejson.tests.test_indent', - 'simplejson.tests.test_pass1', - 'simplejson.tests.test_pass2', - 'simplejson.tests.test_pass3', - 'simplejson.tests.test_recursion', - 'simplejson.tests.test_scanstring', - 'simplejson.tests.test_separators', - 'simplejson.tests.test_speedups', - 'simplejson.tests.test_unicode', - 'simplejson.tests.test_decimal', - 'simplejson.tests.test_tuple', - 'simplejson.tests.test_namedtuple', - 'simplejson.tests.test_tool', - 'simplejson.tests.test_for_json', - ]) - suite = additional_tests(suite) - return OptionalExtensionTestSuite([suite]) + def get_suite(): + return additional_tests( + unittest.TestLoader().loadTestsFromNames([ + 'simplejson.tests.test_bigint_as_string', + 'simplejson.tests.test_check_circular', + 'simplejson.tests.test_decode', + 'simplejson.tests.test_default', + 'simplejson.tests.test_dump', + 'simplejson.tests.test_encode_basestring_ascii', + 'simplejson.tests.test_encode_for_html', + 'simplejson.tests.test_errors', + 'simplejson.tests.test_fail', + 'simplejson.tests.test_float', + 'simplejson.tests.test_indent', + 'simplejson.tests.test_pass1', + 'simplejson.tests.test_pass2', + 'simplejson.tests.test_pass3', + 'simplejson.tests.test_recursion', + 'simplejson.tests.test_scanstring', + 'simplejson.tests.test_separators', + 'simplejson.tests.test_speedups', + 'simplejson.tests.test_unicode', + 'simplejson.tests.test_decimal', + 'simplejson.tests.test_tuple', + 'simplejson.tests.test_namedtuple', + 'simplejson.tests.test_tool', + 'simplejson.tests.test_for_json', + ])) + suite = get_suite() + import simplejson + if simplejson._import_c_make_encoder() is None: + suite.addTest(TestMissingSpeedups()) + else: + suite = unittest.TestSuite([ + suite, + NoExtensionTestSuite([get_suite()]), + ]) + return suite def main(): |