MCPcopy Create free account
hub / github.com/Azure-Samples/rag-postgres-openai-python / wait_for_server_ready

Function wait_for_server_ready

tests/e2e.py:17–28  ·  view source on GitHub ↗

Make requests to provided url until it responds without error.

(url: str, timeout: float = 10.0, check_interval: float = 0.5)

Source from the content-addressed store, hash-verified

15
16
17def wait_for_server_ready(url: str, timeout: float = 10.0, check_interval: float = 0.5) -> bool:
18 """Make requests to provided url until it responds without error."""
19 conn_error = None
20 for _ in range(int(timeout / check_interval)):
21 try:
22 requests.get(url)
23 except requests.ConnectionError as exc:
24 time.sleep(check_interval)
25 conn_error = str(exc)
26 else:
27 return True
28 raise RuntimeError(conn_error)
29
30
31@pytest.fixture(scope="session")

Callers 1

live_server_urlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected