Skip to content

Commit 5fefc0d

Browse files
Fix tests
1 parent 5b70387 commit 5fefc0d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,12 @@ async def run():
129129
def test_not_recording(self):
130130
mock_tracer = mock.Mock()
131131
mock_span = mock.Mock()
132+
mock_context = mock.MagicMock()
132133
mock_span.is_recording.return_value = False
133-
mock_span.__enter__ = mock.Mock(return_value=(mock.Mock(), None))
134-
mock_span.__exit__ = mock.Mock(return_value=None)
135-
mock_tracer.start_span.return_value = mock_span
136-
mock_tracer.start_as_current_span.return_value = mock_span
134+
mock_context.__enter__.return_value = mock_span
135+
mock_context.__exit__.return_value = None
136+
mock_tracer.start_span.return_value = mock_context
137+
mock_tracer.start_as_current_span.return_value = mock_context
137138
with mock.patch("opentelemetry.trace.get_tracer") as tracer:
138139
tracer.return_value = mock_tracer
139140
engine = create_engine("sqlite:///:memory:")

0 commit comments

Comments
 (0)