Skip to main content
Glama
Yoosu-L
by Yoosu-L
test_latency.py842 B
import pytest import respx from httpx import Response from llm_api_benchmark_mcp_server.utils.latency import measure_latency @respx.mock @pytest.mark.asyncio async def test_measure_latency_success(): base_url = "http://test.com" respx.get(f"{base_url}/").mock(return_value=Response(200)) latency = await measure_latency(base_url, 1) assert isinstance(latency, float) assert latency > 0 @respx.mock @pytest.mark.asyncio async def test_measure_latency_connection_error(): base_url = "http://test.com" respx.get(f"{base_url}/").mock(side_effect=ConnectionError("Test error")) with pytest.raises(ConnectionError): await measure_latency(base_url, 1) @pytest.mark.asyncio async def test_measure_latency_invalid_url(): with pytest.raises(ValueError): await measure_latency("invalid-url", 1)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Yoosu-L/llm-api-benchmark-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server