[verified] feat: pin native protobuf and gRPC generation

This commit is contained in:
Dobromir Popov
2026-07-17 23:43:03 +03:00
parent db59caa8e9
commit 902ecde363
7 changed files with 288 additions and 61 deletions

View File

@@ -612,6 +612,27 @@ def test_a_peer_still_sending_the_retired_field_does_not_corrupt_the_tensor():
assert decode_tensor(pb.NamedTensor.FromString(wire)) == b"\xaa" * 32
def test_native_toolchain_bootstrap_resolves_relative_prefix_before_temp_chdir(tmp_path):
script = REPO_ROOT / "scripts/bootstrap_native_toolchain.sh"
result = subprocess.run(
["bash", str(script), "--print-prefix", "relative/toolchain"],
cwd=tmp_path,
capture_output=True,
text=True,
)
assert result.returncode == 0, result.stdout + result.stderr
assert pathlib.Path(result.stdout.strip()) == tmp_path / "relative/toolchain"
def test_python_generator_rejects_the_wrong_grpcio_tools_version(monkeypatch):
from scripts import generate_native_protocol
monkeypatch.setattr(generate_native_protocol.metadata, "version", lambda _: "0.0.0")
with pytest.raises(SystemExit, match="found 0.0.0, require 1.82.1"):
generate_native_protocol._require_grpcio_tools_version()
def test_generated_python_stubs_match_the_proto():
pytest.importorskip("grpc_tools", reason="protoc toolchain is required to verify")
result = subprocess.run(