Prepare Python SDK public PyPI publication
This commit is contained in:
@@ -721,8 +721,10 @@ def test_client_request_times_out_when_bridge_does_not_respond(tmp_path: Path) -
|
||||
script = tmp_path / "fake_bridge.py"
|
||||
script.write_text(
|
||||
"""
|
||||
import sys
|
||||
import time
|
||||
|
||||
print("bridge is still starting", file=sys.stderr, flush=True)
|
||||
time.sleep(60)
|
||||
""".strip()
|
||||
)
|
||||
@@ -736,8 +738,9 @@ time.sleep(60)
|
||||
start = time.monotonic()
|
||||
try:
|
||||
client.initialize(provider="deepseek-official", cwd="/workspace", model="dsagent")
|
||||
except TimeoutError:
|
||||
except TimeoutError as exc:
|
||||
assert time.monotonic() - start < 2
|
||||
assert "bridge is still starting" in str(exc)
|
||||
else:
|
||||
raise AssertionError("initialize should time out")
|
||||
|
||||
|
||||
@@ -57,6 +57,10 @@ def test_pep440_version_spells_a_prerelease_the_python_way() -> None:
|
||||
build_python_release.pep440_version("1.2.3-nightly")
|
||||
|
||||
|
||||
def test_macos_wheel_tag_does_not_claim_unsupported_node_platforms() -> None:
|
||||
assert build_python_release.PLATFORMS["macos-arm64"][0] == "macosx_14_0_arm64"
|
||||
|
||||
|
||||
def test_stage_sdk_keeps_distribution_module_and_runtime_pin_distinct(tmp_path: Path) -> None:
|
||||
destination = tmp_path / "staging"
|
||||
|
||||
@@ -66,6 +70,8 @@ def test_stage_sdk_keeps_distribution_module_and_runtime_pin_distinct(tmp_path:
|
||||
assert 'name = "deepseek-harness-sdk"' in pyproject
|
||||
assert 'version = "1.2.3"' in pyproject
|
||||
assert '"deepseek-harness-runtime-bin==1.2.3"' in pyproject
|
||||
assert 'license-files = ["LICENSE"]' in pyproject
|
||||
assert (destination / "LICENSE").read_bytes() == (ROOT / "LICENSE").read_bytes()
|
||||
assert (destination / "src" / "deepseek_harness" / "__init__.py").is_file()
|
||||
|
||||
|
||||
@@ -88,3 +94,9 @@ def test_stage_runtime_copies_platform_payload(
|
||||
|
||||
runtime_dir = destination / "src" / "deepseek_harness_runtime" / "runtime"
|
||||
assert {path.name: path.read_bytes() for path in runtime_dir.glob("dsh-jsonrpc-agent-pkg-*")} == expected
|
||||
pyproject = (destination / "pyproject.toml").read_text()
|
||||
assert 'license-files = ["LICENSE", "THIRD_PARTY_NOTICES.md"]' in pyproject
|
||||
assert (destination / "LICENSE").read_bytes() == (ROOT / "LICENSE").read_bytes()
|
||||
assert (destination / "THIRD_PARTY_NOTICES.md").read_bytes() == (
|
||||
ROOT / "THIRD_PARTY_NOTICES.md"
|
||||
).read_bytes()
|
||||
|
||||
32
python/sdk/tests/test_smoke_model.py
Normal file
32
python/sdk/tests/test_smoke_model.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import runpy
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[3]
|
||||
SMOKE = runpy.run_path(ROOT / "scripts" / "smoke-python-runtime.py")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("prompt_name", "expected"),
|
||||
[
|
||||
("SNAPSHOT_DIRECT_CHILD_PROMPT", "DIRECT_CHILD_OK"),
|
||||
("SNAPSHOT_WORKFLOW_CHILD_PROMPT", "WORKFLOW_CHILD_OK"),
|
||||
],
|
||||
)
|
||||
def test_child_prompt_precedes_runtime_context(prompt_name: str, expected: str) -> None:
|
||||
chunks = SMOKE["completion_chunks"]({
|
||||
"messages": [
|
||||
{"role": "user", "content": SMOKE[prompt_name]},
|
||||
{"role": "user", "content": "Current runtime context"},
|
||||
],
|
||||
})
|
||||
|
||||
assert any(
|
||||
choice.get("delta", {}).get("content") == expected
|
||||
for chunk in chunks
|
||||
for choice in chunk.get("choices", [])
|
||||
)
|
||||
Reference in New Issue
Block a user