Skip to content

Commit 3bf5e98

Browse files
committed
fix test_asgi_issue_1883
1 parent fc070c3 commit 3bf5e98

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -801,18 +801,15 @@ class TestAsgiApplicationRaisingError(AsgiTestBase):
801801
def tearDown(self):
802802
pass
803803

804-
@mock.patch(
805-
"opentelemetry.instrumentation.asgi.collect_custom_headers_attributes",
806-
side_effect=ValueError("whatever"),
807-
)
808-
def test_asgi_issue_1883(
809-
self, mock_collect_custom_request_headers_attributes
810-
):
804+
def test_asgi_issue_1883(self):
811805
"""
812806
Test that exception UnboundLocalError local variable 'start' referenced before assignment is not raised
813807
See https://github.com/open-telemetry/opentelemetry-python-contrib/issues/1883
814808
"""
815-
app = otel_asgi.OpenTelemetryMiddleware(simple_asgi)
809+
async def bad_app(_scope, _receive, _send):
810+
raise ValueError("whatever")
811+
812+
app = otel_asgi.OpenTelemetryMiddleware(bad_app)
816813
self.seed_app(app)
817814
self.send_default_request()
818815
try:

0 commit comments

Comments
 (0)