Spaces:
Sleeping
Sleeping
Download tests/e2e/test_e2e_app.py from neurostack-in/talk2map-prod: direct link, hf CLI and curl.
- Browser
- Download file 686 Bytes
-
https://huggingface.co/spaces/neurostack-in/talk2map-prod/resolve/main/tests/e2e/test_e2e_app.py
- Command line
-
hf download hf://spaces/neurostack-in/talk2map-prod/tests/e2e/test_e2e_app.py
-
curl -L -o test_e2e_app.py https://huggingface.co/spaces/neurostack-in/talk2map-prod/resolve/main/tests/e2e/test_e2e_app.py
686 Bytes
| import subprocess | |
| import time | |
| import requests | |
| BBOX = { | |
| "north_east": {"lat": 40.0, "lon": -73.0}, | |
| "south_west": {"lat": 39.0, "lon": -74.0}, | |
| } | |
| def start_server(): | |
| proc = subprocess.Popen( | |
| ["uvicorn", "api.app:app", "--port", "8001", "--host", "127.0.0.1"], | |
| stdout=subprocess.PIPE, | |
| stderr=subprocess.PIPE, | |
| ) | |
| # give uvicorn a moment to boot | |
| time.sleep(2) | |
| return proc | |
| def test_e2e_health_and_chat(): | |
| proc = start_server() | |
| try: | |
| # health check | |
| r = requests.get("http://127.0.0.1:8001/health") | |
| assert r.status_code == 200 | |
| assert r.json()["status"] == "ok" | |
| finally: | |
| proc.terminate() | |