From 628a8a1eacb81be6c8bcd073725c2792bcde1142 Mon Sep 17 00:00:00 2001 From: Ankita-Advitot Date: Fri, 2 Oct 2026 22:40:46 +0530 Subject: [PATCH] Fix ruff lint issues in test_http_span.py --- tests/test_http_span.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_http_span.py b/tests/test_http_span.py index 6d948651..52a24746 100644 --- a/tests/test_http_span.py +++ b/tests/test_http_span.py @@ -770,8 +770,8 @@ async def test_internal_client_nested_in_route_handler_span(ds, otel_spans): server = _server_spans(otel_spans) assert len(server) == 2 - outer = [s for s in server if s.name.startswith("GET ^/-/nested-route")][0] - inner = [s for s in server if s != outer][0] + outer = next(s for s in server if s.name.startswith("GET ^/-/nested-route")) + inner = next(s for s in server if s != outer) assert inner.parent is not None assert inner.parent.span_id == outer.context.span_id @@ -792,8 +792,8 @@ async def test_internal_client_nested_in_route_handler_span(ds, otel_spans): server = _server_spans(otel_spans) assert len(server) == 2 - outer = [s for s in server if s.name.startswith("GET ^/-/nested-route")][0] - inner = [s for s in server if s != outer][0] + outer = next(s for s in server if s.name.startswith("GET ^/-/nested-route")) + inner = next(s for s in server if s != outer) assert outer.parent is None assert "datasette.internal_client" not in outer.attributes @@ -812,7 +812,7 @@ async def test_internal_client_nested_in_custom_span(ds, otel_spans): (e.g., from a plugin or background task) nests under that span. """ otel_spans.clear() - with tracer.start_as_current_span("plugin.work") as parent: + with tracer.start_as_current_span("plugin.work"): response = await ds.client.get("/-/versions.json") assert response.status_code == 200 @@ -841,7 +841,7 @@ async def test_internal_client_explicit_traceparent_takes_priority(ds, otel_span parent_span_id = "00f067aa0ba902b7" otel_spans.clear() - with tracer.start_as_current_span("plugin.work") as parent: + with tracer.start_as_current_span("plugin.work"): response = await ds.client.get( "/-/versions.json", headers={"traceparent": f"00-{trace_id}-{parent_span_id}-01"},