Build Rust extensions on demand in source checkouts (#34994)
This commit is contained in:
@@ -2119,8 +2119,6 @@ class TestGrpcServerArgs(CustomTestCase):
|
||||
arg-parsing tests above never call start_server, so a stray kwarg (e.g.
|
||||
the removed max_prefill_tokens) would only surface as a TypeError at
|
||||
launch. This mocks the native extension and locks the kwarg set."""
|
||||
import sys
|
||||
|
||||
from sglang.srt.entrypoints import http_server
|
||||
|
||||
fake_core = SimpleNamespace(start_server=MagicMock(return_value="handle"))
|
||||
@@ -2128,13 +2126,14 @@ class TestGrpcServerArgs(CustomTestCase):
|
||||
server_args = SimpleNamespace(
|
||||
host="127.0.0.1", grpc_port=50051, grpc_worker_threads=4
|
||||
)
|
||||
with patch.dict(
|
||||
sys.modules,
|
||||
{
|
||||
"sglang.srt.grpc": SimpleNamespace(_core=fake_core),
|
||||
"sglang.srt.grpc._core": fake_core,
|
||||
"sglang.srt.entrypoints.grpc_bridge": fake_bridge,
|
||||
},
|
||||
with (
|
||||
patch(
|
||||
"sglang.srt.rust_extensions.load_rust_extension",
|
||||
return_value=fake_core,
|
||||
) as load_rust_extension,
|
||||
patch.dict(
|
||||
"sys.modules", {"sglang.srt.entrypoints.grpc_bridge": fake_bridge}
|
||||
),
|
||||
):
|
||||
handle = http_server._start_native_grpc_server_for_runtime(
|
||||
server_args=server_args,
|
||||
@@ -2144,6 +2143,7 @@ class TestGrpcServerArgs(CustomTestCase):
|
||||
)
|
||||
|
||||
self.assertEqual(handle, "handle")
|
||||
load_rust_extension.assert_called_once_with("sglang.srt.rust_extensions._grpc")
|
||||
_, kwargs = fake_core.start_server.call_args
|
||||
self.assertEqual(
|
||||
set(kwargs), {"host", "port", "runtime_handle", "worker_threads"}
|
||||
|
||||
Reference in New Issue
Block a user