Skip to content

Commit a9f0f0c

Browse files
committed
basic linting
1 parent 045db3f commit a9f0f0c

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

tests/loki_test.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
pytestmark = pytest.mark.anyio
2626

27+
2728
@pytest.fixture
2829
def mcp_url():
2930
return os.environ.get("MCP_GRAFANA_URL", DEFAULT_MCP_URL)
@@ -81,7 +82,9 @@ async def test_loki(model: str, mcp_client: ClientSession):
8182
# Verify Loki datasource exists
8283
loki_datasources = [ds for ds in datasources_data if ds.get("type") == "loki"]
8384
assert len(loki_datasources) > 0, "No Loki datasource found"
84-
print(f"\nFound Loki datasource: {loki_datasources[0]['name']} (uid: {loki_datasources[0]['uid']})")
85+
print(
86+
f"\nFound Loki datasource: {loki_datasources[0]['name']} (uid: {loki_datasources[0]['uid']})"
87+
)
8588

8689
# Call the LLM including the tool call result.
8790
response = await acompletion(
@@ -149,7 +152,9 @@ async def test_loki_container_labels(model: str, mcp_client: ClientSession):
149152
# Verify Loki datasource exists
150153
loki_datasources = [ds for ds in datasources_data if ds.get("type") == "loki"]
151154
assert len(loki_datasources) > 0, "No Loki datasource found"
152-
print(f"\nFound Loki datasource: {loki_datasources[0]['name']} (uid: {loki_datasources[0]['uid']})")
155+
print(
156+
f"\nFound Loki datasource: {loki_datasources[0]['name']} (uid: {loki_datasources[0]['uid']})"
157+
)
153158

154159
# Call the LLM including the tool call result.
155160
response = await acompletion(
@@ -165,10 +170,7 @@ async def test_loki_container_labels(model: str, mcp_client: ClientSession):
165170
response,
166171
mcp_client,
167172
"list_loki_label_values",
168-
{
169-
"datasourceUid": "loki",
170-
"labelName": "container"
171-
},
173+
{"datasourceUid": "loki", "labelName": "container"},
172174
)
173175
)
174176

@@ -219,8 +221,12 @@ async def assert_and_handle_tool_call(
219221

220222
if expected_args:
221223
for key, value in expected_args.items():
222-
assert key in arguments, f"Missing required argument '{key}' in tool call"
223-
assert arguments[key] == value, f"Argument '{key}' has wrong value. Expected: {value}, Got: {arguments[key]}"
224+
assert key in arguments, (
225+
f"Missing required argument '{key}' in tool call"
226+
)
227+
assert arguments[key] == value, (
228+
f"Argument '{key}' has wrong value. Expected: {value}, Got: {arguments[key]}"
229+
)
224230
result = await mcp_client.call_tool(tool_call.function.name, arguments)
225231
# Assume each tool returns a single text content for now
226232
assert len(result.content) == 1

0 commit comments

Comments
 (0)