diff --git a/.travis.yml b/.travis.yml index b4c751933cff360452b701de00c77f2a5010f88a..7c079006d78f034c9b0c7c3de299874609f8bfc8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -90,6 +90,22 @@ jobs: - twine upload -u $PYPI_USER -p $PYPI_PWD *.whl after_script: - echo "Done" + - stage: deploy + python: "3.8" + arch: "ppc64le" + before_script: + - sudo apt-get update + - sudo apt-get install -y patchelf + - pip install wheel auditwheel twine doctor-wheel cython + script: + - python setup.py bdist_wheel + - cd dist + - doctor-wheel *.whl + - auditwheel repair --plat manylinux2014_ppc64le *.whl + - cd wheelhouse + - twine upload -u $PYPI_USER -p $PYPI_PWD *.whl + after_script: + - echo "Done" - stage: deploy python: "3.8" arch: "arm64" @@ -101,7 +117,7 @@ jobs: - python setup.py bdist_wheel - cd dist - doctor-wheel *.whl - - auditwheel repair --plat manylinux2014_x86_64 *.whl + - auditwheel repair --plat manylinux2014_arm64 *.whl - cd wheelhouse - twine upload -u $PYPI_USER -p $PYPI_PWD *.whl after_script: diff --git a/docs/changelog.md b/docs/changelog.md index 2c6eb0ddb90cef97d6d6b3f51c7c9a5151bc0f5e..abbf7bd022baf87b47161bb323eb98e60db8155d 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -5,7 +5,7 @@ v2.9 ---- * minor refactor: code deduplication -* fixed some bugs on ARM +* fixed some bugs with unserializing ints on other platforms than x86_64 v2.8 ---- diff --git a/setup.cfg b/setup.cfg index 02c13534f408ec71569d7880d3fa4f2ff663506a..0b4dc578c3d6adb5e9eab4bdfff344559ce5b958 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ # coding: utf-8 [metadata] -version = 2.9a2 +version = 2.9 name = minijson long_description = file: README.md long_description_content_type = text/markdown; charset=UTF-8 diff --git a/tests/test_minijson.py b/tests/test_minijson.py index bb9cb93feb447860e9563a6b8fa29e59186b55a1..f96ac94d8c0f5ea3ec2f11cfdc402912a019ab33 100644 --- a/tests/test_minijson.py +++ b/tests/test_minijson.py @@ -1,3 +1,4 @@ +import typing as tp import unittest from minijson import dumps, loads, dumps_object, loads_object, EncodingError, DecodingError, \ @@ -11,13 +12,6 @@ class TestMiniJSON(unittest.TestCase): enc.encode({"test": "2", "value": 2}) enc.encode({b"test": "2", b"value": 2}) - def test_are_we_sane(self): - self.assertTrue(-128 <= -1 <= 127) - - def test_arm_bug(self): - b = dumps(-1) - self.assertEqual(b, b'\x03\xFF') - def test_encoder_overrided_default(self): class Encoder(MiniJSONEncoder): def default(self, v): @@ -66,8 +60,12 @@ class TestMiniJSON(unittest.TestCase): def assertLoadingIsDecodingError(self, b: bytes): self.assertRaises(DecodingError, lambda: loads(b)) - def assertSameAfterDumpsAndLoads(self, c): - self.assertEqual(loads(dumps(c)), c) + def assertSameAfterDumpsAndLoads(self, c, repres: tp.Optional[bytes] = None): + b = dumps(c) + if repres is not None: + self.assertEqual(b, repres) + d = loads(b) + self.assertEqual(c, d) def test_default_returns_nonjsonable(self): """Assert that if transform returns a non-JSONable value, EncodingError is raised""" @@ -178,10 +176,10 @@ class TestMiniJSON(unittest.TestCase): self.assertSameAfterDumpsAndLoads({'a' * 300: 2}) def test_negatives(self): - self.assertSameAfterDumpsAndLoads(-1) - self.assertSameAfterDumpsAndLoads(-259) - self.assertSameAfterDumpsAndLoads(-0x7FFF) - self.assertSameAfterDumpsAndLoads(-0xFFFF) + self.assertSameAfterDumpsAndLoads(-1, b'\x03\xFF') + self.assertSameAfterDumpsAndLoads(-259, b'\x02\xfe\xfd') + self.assertSameAfterDumpsAndLoads(-0x7FFF, b'\x02\x80\x01') + self.assertSameAfterDumpsAndLoads(-0xFFFF, b'\x01\xff\xff\x00\x01') self.assertSameAfterDumpsAndLoads(0x1FFFF) self.assertSameAfterDumpsAndLoads(0xFFFFFFFF) self.assertSameAfterDumpsAndLoads(0x1FFFFFF)