From 16e5da3be82e67421e526bf63d44bbb69b8b8874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl> Date: Fri, 6 Aug 2021 18:47:55 +0200 Subject: [PATCH] fix deploy bug, v2.9 --- .travis.yml | 18 +++++++++++++++++- docs/changelog.md | 2 +- setup.cfg | 2 +- tests/test_minijson.py | 24 +++++++++++------------- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index b4c7519..7c07900 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 2c6eb0d..abbf7bd 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 02c1353..0b4dc57 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 bb9cb93..f96ac94 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) -- GitLab