diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 998d2b2..3cb4454 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -16,12 +16,12 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/tests/test_all_protocols_binary_field.py b/tests/test_all_protocols_binary_field.py index 116b029..39135de 100644 --- a/tests/test_all_protocols_binary_field.py +++ b/tests/test_all_protocols_binary_field.py @@ -7,11 +7,8 @@ import pytest import six +from thriftpy2 import _compat from thriftpy2.thrift import TType, TPayloadMeta -try: - from thriftpy2.protocol import cybin -except ImportError: - cybin = None import thriftpy2 from thriftpy2.http import ( make_server as make_http_server, @@ -263,12 +260,12 @@ def run_server(): time.sleep(0.2) -@pytest.mark.skipif(cybin is None, reason="Must be run in cpython") +@pytest.mark.skipif(_compat.PYPY, reason="Must be run in cpython") def test_complex_map(): """ Test from #156 """ - proto = cybin + from thriftpy2.protocol import cybin as proto b1 = TCyMemoryBuffer() proto.write_val(b1, TType.MAP, {"hello": "1"}, spec=(TType.STRING, TType.STRING)) diff --git a/tests/test_protocol_binary.py b/tests/test_protocol_binary.py index 2e9b0be..98f7f57 100644 --- a/tests/test_protocol_binary.py +++ b/tests/test_protocol_binary.py @@ -4,6 +4,7 @@ import pytest +from thriftpy2 import _compat from thriftpy2 import load from thriftpy2.protocol import binary as proto from thriftpy2.thrift import TPayload, TType @@ -172,6 +173,7 @@ def test_write_huge_struct(): proto.TBinaryProtocol(b).write_struct(item) +@pytest.mark.skipif(_compat.PYPY, reason="cybin can't be used in pypy") def test_string_binary_equivalency(): from thriftpy2.protocol.binary import TBinaryProtocolFactory from thriftpy2.protocol.cybin import TCyBinaryProtocolFactory diff --git a/tests/test_protocol_cybinary.py b/tests/test_protocol_cybinary.py index 41c4494..b71a770 100644 --- a/tests/test_protocol_cybinary.py +++ b/tests/test_protocol_cybinary.py @@ -11,13 +11,12 @@ from thriftpy2.thrift import TDecodeException, TPayload, TType from thriftpy2.transport import TServerSocket, TSocket from thriftpy2.utils import hexlify - -pytestmark = pytest.mark.skipif(PYPY, - reason="cython not enabled in pypy.") if not PYPY: from thriftpy2.protocol import cybin as proto from thriftpy2.transport.buffered import TCyBufferedTransport from thriftpy2.transport.memory import TCyMemoryBuffer +else: + pytest.skip("cython not enabled in pypy.", allow_module_level=True) class TItem(TPayload):