v0.1.3
This commit is contained in:
@ -2,7 +2,7 @@ openapi: "3.1.0"
|
|||||||
info:
|
info:
|
||||||
title: Wrenn API
|
title: Wrenn API
|
||||||
description: MicroVM-based code execution platform API.
|
description: MicroVM-based code execution platform API.
|
||||||
version: "0.1.3"
|
version: "0.1.4"
|
||||||
|
|
||||||
servers:
|
servers:
|
||||||
- url: http://localhost:8080
|
- url: http://localhost:8080
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "wrenn"
|
name = "wrenn"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
description = "Python SDK for Wrenn"
|
description = "Python SDK for Wrenn"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# generated by datamodel-codegen:
|
# generated by datamodel-codegen:
|
||||||
# filename: openapi.yaml
|
# filename: openapi.yaml
|
||||||
# timestamp: 2026-04-22T20:21:34+00:00
|
# timestamp: 2026-05-04T20:57:00+00:00
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
from pydantic import AwareDatetime, BaseModel, EmailStr, Field
|
from pydantic import AwareDatetime, BaseModel, EmailStr, Field
|
||||||
|
|||||||
@ -15,6 +15,17 @@ pytestmark = pytest.mark.integration
|
|||||||
_env_loaded = False
|
_env_loaded = False
|
||||||
|
|
||||||
|
|
||||||
|
def _wait_for_pid_dead(capsule: Capsule, pid: int, timeout: float = 5.0) -> bool:
|
||||||
|
deadline = time.monotonic() + timeout
|
||||||
|
while time.monotonic() < deadline:
|
||||||
|
result = capsule.commands.run(f"ps -p {pid} -o stat= 2>/dev/null || true")
|
||||||
|
state = result.stdout.strip()
|
||||||
|
if not state or state.startswith("Z"):
|
||||||
|
return True
|
||||||
|
time.sleep(0.2)
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def _ensure_env() -> None:
|
def _ensure_env() -> None:
|
||||||
global _env_loaded
|
global _env_loaded
|
||||||
if _env_loaded:
|
if _env_loaded:
|
||||||
@ -218,11 +229,7 @@ class TestCommands:
|
|||||||
def test_kill_process(self):
|
def test_kill_process(self):
|
||||||
handle = self.capsule.commands.run("sleep 30", background=True)
|
handle = self.capsule.commands.run("sleep 30", background=True)
|
||||||
self.capsule.commands.kill(handle.pid)
|
self.capsule.commands.kill(handle.pid)
|
||||||
time.sleep(0.5)
|
assert _wait_for_pid_dead(self.capsule, handle.pid)
|
||||||
|
|
||||||
processes = self.capsule.commands.list()
|
|
||||||
pids = [p.pid for p in processes]
|
|
||||||
assert handle.pid not in pids
|
|
||||||
|
|
||||||
def test_run_duration_ms(self):
|
def test_run_duration_ms(self):
|
||||||
result = self.capsule.commands.run("sleep 1")
|
result = self.capsule.commands.run("sleep 1")
|
||||||
|
|||||||
Reference in New Issue
Block a user