Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpirker committed Nov 22, 2024
1 parent 308a179 commit 2feb299
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/integrations/wsgi/test_wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,12 @@ def test_long_running_transaction_finished(sentry_init, capture_events):
# we allow transactions to be 0.5 seconds as a maximum
new_max_duration = 0.5

with mock.patch.object(sentry_sdk.integrations.wsgi, "MAX_TRANSACTION_DURATION_SECONDS", new_max_duration):
with mock.patch.object(
sentry_sdk.integrations.wsgi,
"MAX_TRANSACTION_DURATION_SECONDS",
new_max_duration,
):

def generate_content():
# This response will take 1.5 seconds to generate
for _ in range(15):
Expand All @@ -525,5 +530,10 @@ def long_running_app(environ, start_response):

(transaction,) = events

transaction_duration = (datetime_from_isoformat(transaction["timestamp"]) - datetime_from_isoformat(transaction["start_timestamp"])).total_seconds()
assert transaction_duration <= new_max_duration * 1.2 # we allow 2% margin for processing the request
transaction_duration = (
datetime_from_isoformat(transaction["timestamp"])
- datetime_from_isoformat(transaction["start_timestamp"])
).total_seconds()
assert (
transaction_duration <= new_max_duration * 1.2
) # we allow 2% margin for processing the request

0 comments on commit 2feb299

Please sign in to comment.