From 1042bc6d74110bdaf97228f7db132af7a69cced2 Mon Sep 17 00:00:00 2001 From: cocolato Date: Thu, 18 Apr 2024 23:27:20 +0800 Subject: [PATCH] support mp spawn mode --- tests/test_all_protocols_binary_field.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/test_all_protocols_binary_field.py b/tests/test_all_protocols_binary_field.py index 8ddf6a5..df25df8 100644 --- a/tests/test_all_protocols_binary_field.py +++ b/tests/test_all_protocols_binary_field.py @@ -26,8 +26,6 @@ from thriftpy2.transport import TBufferedTransportFactory, TCyMemoryBuffer -# if sys.platform == "win32": -# pytest.skip("requires fork", allow_module_level=True) protocols = [TApacheJSONProtocolFactory, @@ -166,11 +164,16 @@ def test_exceptions(server_func, proto_factory): ) TestException = test_thrift.TestException - class Handler(object): - def do_error(self, arg): - raise TestException(message=arg) - def do_server(): + import thriftpy2 + test_thrift = thriftpy2.load( + "apache_json_test.thrift", + module_name="test_thrift" + ) + TestException = test_thrift.TestException + class Handler(object): + def do_error(self, arg): + raise TestException(message=arg) server = server_func[0]( service=test_thrift.TestService, handler=Handler(), @@ -242,6 +245,8 @@ def test(t): trans_factory = TBufferedTransportFactory def run_server(): + import thriftpy2 + spec = thriftpy2.load("bin_test.thrift", module_name="bin_thrift") server = make_rpc_server( spec.BinService, handler=Handler(),