Skip to content

Commit

Permalink
Fix test in pypy
Browse files Browse the repository at this point in the history
  • Loading branch information
aisk committed Apr 3, 2024
1 parent f500f9f commit 913a243
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
9 changes: 3 additions & 6 deletions tests/test_all_protocols_binary_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 2 additions & 0 deletions tests/test_protocol_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/test_protocol_cybinary.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
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


pytest.mark.skipif(PYPY, reason="cython not enabled in pypy.")


class TItem(TPayload):
thrift_spec = {
1: (TType.I32, "id", False),
Expand Down

0 comments on commit 913a243

Please sign in to comment.