Skip to content

Commit

Permalink
black formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
siminn-arnorgj committed Nov 8, 2023
1 parent f2aa453 commit 0aca682
Showing 1 changed file with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,18 @@ async def long_response_asgi(scope, receive, send):
],
}
)
await send({"type": "http.response.body", "body": b"*", "more_body": True})
await send({"type": "http.response.body", "body": b"*", "more_body": True})
await send({"type": "http.response.body", "body": b"*", "more_body": True})
await send({"type": "http.response.body", "body": b"*", "more_body": False})
await send(
{"type": "http.response.body", "body": b"*", "more_body": True}
)
await send(
{"type": "http.response.body", "body": b"*", "more_body": True}
)
await send(
{"type": "http.response.body", "body": b"*", "more_body": True}
)
await send(
{"type": "http.response.body", "body": b"*", "more_body": False}
)


async def background_execution_asgi(scope, receive, send):
Expand All @@ -142,7 +150,12 @@ async def background_execution_asgi(scope, receive, send):
],
}
)
await send({"type": "http.response.body", "body": b"*", })
await send(
{
"type": "http.response.body",
"body": b"*",
}
)
time.sleep(simulated_background_task_execution_time_s)


Expand Down Expand Up @@ -280,7 +293,11 @@ def test_asgi_exc_info(self):
self.validate_outputs(outputs, error=ValueError)

def test_long_response(self):
"""Test that the server span is ended on the final response body message. If the server span is ended early then this test will fail due discrepancies in the expected list of spans and the emitted list of spans."""
"""Test that the server span is ended on the final response body message.
If the server span is ended early then this test will fail due
to discrepancies in the expected list of spans and the emitted list of spans.
"""
app = otel_asgi.OpenTelemetryMiddleware(long_response_asgi)
self.seed_app(app)
self.send_default_request()
Expand Down Expand Up @@ -312,7 +329,8 @@ def test_background_execution(self):
print(span_duration_nanos)
self.assertLessEqual(
span_duration_nanos,
simulated_background_task_execution_time_s * 10**9)
simulated_background_task_execution_time_s * 10**9,
)

def test_override_span_name(self):
"""Test that default span_names can be overwritten by our callback function."""
Expand Down

0 comments on commit 0aca682

Please sign in to comment.