mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-31 00:03:01 +03:00
test(ci): isolate Windows process checks
This commit is contained in:
@@ -96,10 +96,11 @@ jobs:
|
|||||||
os: windows-latest
|
os: windows-latest
|
||||||
python-version: "3.14"
|
python-version: "3.14"
|
||||||
coverage: false
|
coverage: false
|
||||||
# Keep each test file in one worker while using both hosted-runner cores.
|
# Real PowerShell/process-tree tests share the hosted runner's
|
||||||
# Keep test names visible until a Windows-only control-event
|
# Windows console. Separate xdist workers can therefore deliver a
|
||||||
# interruption can be attributed to its active worker/file.
|
# control event across worker boundaries; run this compatibility
|
||||||
pytest_args: "-n 2 --dist loadfile -vv"
|
# matrix serially, as nanobot itself does in one client process.
|
||||||
|
pytest_args: "--full-trace"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|||||||
@@ -896,30 +896,33 @@ class TestWindowsRealExec:
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_windows_powershell_session_output_is_utf8(self):
|
async def test_windows_powershell_session_output_is_utf8(self):
|
||||||
manager = ExecSessionManager()
|
manager = ExecSessionManager()
|
||||||
result = await ExecTool(timeout=180, session_manager=manager).execute(
|
try:
|
||||||
command="Start-Sleep -Milliseconds 1500; Write-Output 'café λ 你好'",
|
result = await ExecTool(timeout=180, session_manager=manager).execute(
|
||||||
shell="powershell",
|
command="Start-Sleep -Milliseconds 1500; Write-Output 'café λ 你好'",
|
||||||
yield_time_ms=1000,
|
shell="powershell",
|
||||||
)
|
yield_time_ms=1000,
|
||||||
|
|
||||||
if "session_id:" in result:
|
|
||||||
session_id = result.split("session_id:", 1)[1].splitlines()[0].strip()
|
|
||||||
poll_result = await WriteStdinTool(manager=manager).execute(
|
|
||||||
session_id=session_id,
|
|
||||||
chars="",
|
|
||||||
wait_for="café λ 你好",
|
|
||||||
wait_timeout_ms=120_000,
|
|
||||||
)
|
)
|
||||||
result += "\n" + poll_result
|
|
||||||
if "Process running." in poll_result:
|
if "session_id:" in result:
|
||||||
final_result = await WriteStdinTool(manager=manager).execute(
|
session_id = result.split("session_id:", 1)[1].splitlines()[0].strip()
|
||||||
|
poll_result = await WriteStdinTool(manager=manager).execute(
|
||||||
session_id=session_id,
|
session_id=session_id,
|
||||||
chars="",
|
chars="",
|
||||||
yield_time_ms=30_000,
|
wait_for="café λ 你好",
|
||||||
|
wait_timeout_ms=120_000,
|
||||||
)
|
)
|
||||||
result += "\n" + final_result
|
result += "\n" + poll_result
|
||||||
assert "Process running." not in final_result
|
if "Process running." in poll_result:
|
||||||
|
final_result = await WriteStdinTool(manager=manager).execute(
|
||||||
|
session_id=session_id,
|
||||||
|
chars="",
|
||||||
|
yield_time_ms=30_000,
|
||||||
|
)
|
||||||
|
result += "\n" + final_result
|
||||||
|
assert "Process running." not in final_result
|
||||||
|
|
||||||
assert "café λ 你好" in result
|
assert "café λ 你好" in result
|
||||||
assert "Exit code: 0" in result
|
assert "Exit code: 0" in result
|
||||||
assert "\x00" not in result
|
assert "\x00" not in result
|
||||||
|
finally:
|
||||||
|
await manager.close_all()
|
||||||
|
|||||||
Reference in New Issue
Block a user