Spaces:
Sleeping

File size: 694 Bytes
07ba06f
 
 
 
fa4d74b
07ba06f
fa4d74b
 
 
 
 
 
 
 
 
 
 
07ba06f
fa4d74b
07ba06f
 
fa4d74b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import asyncio
import json
import httpx
import websockets
import pytest

def test_chat_manual():
    # Only run if server is running
    async def _run():
        uri = "ws://127.0.0.1:8000/ws"
        try:
            async with websockets.connect(uri, open_timeout=1.0) as ws:
                async with httpx.AsyncClient(timeout=5.0) as client:
                    resp = await client.post("http://127.0.0.1:8000/api/trigger", json={"prompt": "Ping"})
                    assert resp.status_code == 200
        except Exception:
            pytest.skip("Swarm server not running locally on port 8000")

    asyncio.run(_run())

if __name__ == "__main__":
    asyncio.run(test_chat_manual())