Skip to content

Commit 216f6d0

Browse files
committed
chore: fix existing ruff violations in decorators
1 parent 2c0b007 commit 216f6d0

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/openadapt_telemetry/decorators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import functools
1212
import time
13-
from typing import Any, Callable, Optional, TypeVar, Union
13+
from typing import Any, Callable, Optional, TypeVar
1414

1515
import sentry_sdk
1616

@@ -57,7 +57,7 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
5757
result = func(*args, **kwargs)
5858
transaction.set_status("ok")
5959
return result
60-
except Exception as e:
60+
except Exception:
6161
transaction.set_status("internal_error")
6262
raise
6363
finally:

tests/test_decorators.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Tests for telemetry decorators."""
22

3-
import os
43
from unittest.mock import MagicMock, patch
54

65
import pytest
@@ -171,20 +170,20 @@ def teardown_method(self):
171170

172171
def test_basic_usage(self):
173172
"""Basic span usage should work."""
174-
with TelemetrySpan("test_op", "test_span") as span:
173+
with TelemetrySpan("test_op", "test_span"):
175174
result = 1 + 1
176175

177176
assert result == 2
178177

179178
def test_with_description(self):
180179
"""Span with description should work."""
181-
with TelemetrySpan("op", "name", description="Test description") as span:
180+
with TelemetrySpan("op", "name", description="Test description"):
182181
pass
183182

184183
def test_exception_handling(self):
185184
"""Exceptions should propagate through span."""
186185
with pytest.raises(ValueError, match="test"):
187-
with TelemetrySpan("op", "name") as span:
186+
with TelemetrySpan("op", "name"):
188187
raise ValueError("test")
189188

190189
def test_set_tag(self):

0 commit comments

Comments
 (0)