Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions tests/integrations/anthropic/test_anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5074,7 +5074,7 @@ def test_system_prompt_with_complex_structure(
assert response == EXAMPLE_MESSAGE

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert len(spans) == 1
(span,) = spans

Expand Down Expand Up @@ -5426,7 +5426,7 @@ def test_message_with_url_image(
client.messages.create(max_tokens=1024, messages=messages, model="model")

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
(span,) = spans

stored_messages = json.loads(
Expand Down Expand Up @@ -5498,7 +5498,7 @@ def test_message_with_file_image(
client.messages.create(max_tokens=1024, messages=messages, model="model")

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
(span,) = spans

stored_messages = json.loads(
Expand Down Expand Up @@ -5614,7 +5614,7 @@ def test_message_with_url_pdf(
client.messages.create(max_tokens=1024, messages=messages, model="model")

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
(span,) = spans

stored_messages = json.loads(
Expand Down Expand Up @@ -5686,7 +5686,7 @@ def test_message_with_file_document(
client.messages.create(max_tokens=1024, messages=messages, model="model")

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
(span,) = spans

stored_messages = json.loads(
Expand Down Expand Up @@ -5916,7 +5916,7 @@ def test_binary_content_not_stored_when_pii_disabled(
client.messages.create(max_tokens=1024, messages=messages, model="model")

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
(span,) = spans

# Messages should not be stored
Expand Down Expand Up @@ -5980,7 +5980,7 @@ def test_binary_content_not_stored_when_prompts_disabled(
client.messages.create(max_tokens=1024, messages=messages, model="model")

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
(span,) = spans

# Messages should not be stored
Expand Down Expand Up @@ -6213,7 +6213,7 @@ def test_input_tokens_include_cache_read_nonstreaming(
)

sentry_sdk.flush()
(span,) = [item.payload for item in items if item.type == "span"]
(span,) = [item.payload for item in items]

# input_tokens should be total: 19 (non-cached) + 2846 (cache_read) = 2865
assert span["attributes"][SPANDATA.GEN_AI_USAGE_INPUT_TOKENS] == 2865
Expand Down
10 changes: 5 additions & 5 deletions tests/integrations/boto3/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_basic(
span.end()

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert len(spans) == 2
span = spans[0]
assert span["attributes"]["sentry.op"] == "http.client"
Expand Down Expand Up @@ -102,7 +102,7 @@ def test_streaming(
span.end()

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert len(spans) == 3

span1 = spans[0]
Expand Down Expand Up @@ -196,7 +196,7 @@ def test_streaming_close(
span.end()

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert len(spans) == 3
span1 = spans[0]
assert span1["attributes"]["sentry.op"] == "http.client"
Expand Down Expand Up @@ -258,7 +258,7 @@ def test_omit_url_data_if_parsing_fails(
span.end()

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert spans[0]["attributes"] == ApproxDict(
{
"http.request.method": "GET",
Expand Down Expand Up @@ -334,7 +334,7 @@ def test_span_origin(
_ = [obj for obj in bucket.objects.all()]

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]

assert spans[1]["attributes"]["sentry.origin"] == "manual"
assert spans[0]["attributes"]["sentry.origin"] == "auto.http.boto3"
Expand Down
10 changes: 5 additions & 5 deletions tests/integrations/django/asgi/test_asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ async def test_active_thread_id(
data = json.loads(response["body"])

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]

for span in spans:
if span["is_segment"] is False:
Expand Down Expand Up @@ -393,7 +393,7 @@ async def test_async_middleware_spans(
assert response["status"] == 200

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]

# Filter out signal-receiver spans — their ordering depends on Django
# module import order and is not what this middleware test verifies.
Expand Down Expand Up @@ -911,7 +911,7 @@ async def test_async_view(
await comm.wait()

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert spans[5]["name"] == "/simple_async_view"
else:
events = capture_events()
Expand Down Expand Up @@ -961,7 +961,7 @@ async def test_transaction_http_method_default(
await comm.wait()

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert spans[5]["attributes"]["http.request.method"] == "GET"
else:
events = capture_events()
Expand Down Expand Up @@ -1025,7 +1025,7 @@ async def test_transaction_http_method_custom(
await comm.wait()

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]

assert spans[10]["attributes"][SPANDATA.HTTP_REQUEST_METHOD] == "OPTIONS"
assert spans[16]["attributes"][SPANDATA.HTTP_REQUEST_METHOD] == "HEAD"
Expand Down
18 changes: 9 additions & 9 deletions tests/integrations/django/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ def test_response_trace(
assert status == "200 OK"

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]

assert (
'- sentry.op="view.response.render": name="serialize response"'
Expand Down Expand Up @@ -1022,7 +1022,7 @@ def test_django_connect_trace(
assert status == "200 OK"

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]

for span in spans:
if span["attributes"].get("sentry.op") == "db":
Expand Down Expand Up @@ -1138,7 +1138,7 @@ def test_db_connection_span_data(
assert status == "200 OK"

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]

for span in spans:
if span["attributes"].get("sentry.op") == "db":
Expand Down Expand Up @@ -1448,7 +1448,7 @@ def test_template_tracing_meta(
content, _, _ = unpack_werkzeug_response(client.get(reverse("template_test3")))
rendered_meta = content.decode("utf-8")

events = [item.payload for item in items if item.type == "event"]
events = [item.payload for item in items]
else:
events = capture_events()

Expand Down Expand Up @@ -1677,7 +1677,7 @@ def test_render_spans(
items = capture_items("span")
client.get(url)
sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert expected_line in render_span_tree(spans)
else:
views_tests = [
Expand Down Expand Up @@ -2000,7 +2000,7 @@ def test_signals_spans_filtering(
client.get(reverse("send_myapp_custom_signal"))

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert (
render_span_tree(spans)
== """\
Expand Down Expand Up @@ -2242,7 +2242,7 @@ def test_span_origin(
client.get(reverse("view_with_signal"))

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]

assert spans[-1]["attributes"]["sentry.origin"] == "auto.http.django"

Expand Down Expand Up @@ -2291,7 +2291,7 @@ def test_transaction_http_method_default(
client.head("/nomessage")

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]

assert spans[2]["attributes"][SPANDATA.HTTP_REQUEST_METHOD] == "GET"
else:
Expand Down Expand Up @@ -2335,7 +2335,7 @@ def test_transaction_http_method_custom(
client.head("/nomessage")

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]

assert spans[4]["attributes"][SPANDATA.HTTP_REQUEST_METHOD] == "OPTIONS"
assert spans[7]["attributes"][SPANDATA.HTTP_REQUEST_METHOD] == "HEAD"
Expand Down
28 changes: 14 additions & 14 deletions tests/integrations/django/test_cache_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_cache_spans_disabled_middleware(
client.get(reverse("not_cached_view"))

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert len(spans) == 2
else:
events = capture_events()
Expand Down Expand Up @@ -162,7 +162,7 @@ def test_cache_spans_disabled_decorator(
client.get(reverse("cached_view"))

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert len(spans) == 2
else:
events = capture_events()
Expand Down Expand Up @@ -205,7 +205,7 @@ def test_cache_spans_disabled_templatetag(
client.get(reverse("view_with_cached_template_fragment"))

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert len(spans) == 2
else:
events = capture_events()
Expand Down Expand Up @@ -250,7 +250,7 @@ def test_cache_spans_middleware(
client.get(reverse("not_cached_view"))

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
# first_event - cache.get
assert spans[0]["attributes"]["sentry.op"] == "cache.get"
assert spans[0]["name"].startswith("views.decorators.cache.cache_header.")
Expand Down Expand Up @@ -370,7 +370,7 @@ def test_cache_spans_decorator(
client.get(reverse("cached_view"))

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
# first_event - cache.get
assert spans[0]["attributes"]["sentry.op"] == "cache.get"
assert spans[0]["name"].startswith("views.decorators.cache.cache_header.")
Expand Down Expand Up @@ -470,7 +470,7 @@ def test_cache_spans_templatetag(
client.get(reverse("view_with_cached_template_fragment"))

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert len(spans) == 5
# first_event - cache.get
assert spans[0]["attributes"]["sentry.op"] == "cache.get"
Expand Down Expand Up @@ -607,7 +607,7 @@ def test_cache_spans_location_with_port(
client.get(reverse("cached_view"))

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]

for span in spans:
if span["is_segment"] is True:
Expand Down Expand Up @@ -660,7 +660,7 @@ def test_cache_spans_location_without_port(
client.get(reverse("cached_view"))

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]

for span in spans:
if span["is_segment"] is True:
Expand Down Expand Up @@ -709,7 +709,7 @@ def test_cache_spans_location_with_cluster(
client.get(reverse("cached_view"))

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]

for span in spans:
# because it is a cluster we do not know what host is actually accessed, so we omit the data
Expand Down Expand Up @@ -757,7 +757,7 @@ def test_cache_spans_item_size(
client.get(reverse("cached_view"))

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert len(spans) == 7
assert spans[0]["attributes"]["sentry.op"] == "cache.get"
assert not spans[0]["attributes"]["cache.hit"]
Expand Down Expand Up @@ -851,7 +851,7 @@ def test_cache_spans_get_custom_default(
cache.get(f"S{id + 2}", default="null")

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert len(spans) == 9

assert spans[0]["attributes"]["sentry.op"] == "cache.put"
Expand Down Expand Up @@ -956,7 +956,7 @@ def test_cache_spans_get_many(
cache.get_many([f"S{id}", f"S{id + 1}"])

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert len(spans) == 8

assert spans[2]["attributes"]["sentry.op"] == "cache.get"
Expand Down Expand Up @@ -1058,7 +1058,7 @@ def test_cache_spans_set_many(
cache.get(f"S{id}")

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]
assert len(spans) == 5

assert spans[2]["attributes"]["sentry.op"] == "cache.put"
Expand Down Expand Up @@ -1125,7 +1125,7 @@ def test_span_origin_cache(
client.get(reverse("cached_view"))

sentry_sdk.flush()
spans = [item.payload for item in items if item.type == "span"]
spans = [item.payload for item in items]

assert spans[1]["attributes"]["sentry.origin"] == "auto.http.django"

Expand Down
Loading
Loading