Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cassandra: fix tests for py313 #3152

Merged
merged 2 commits into from
Dec 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def tearDown(self):
with self.disable_logging():
CassandraInstrumentor().uninstrument()

@property
def _mocked_session(self):
return cassandra.cluster.Session(cluster=mock.Mock(), hosts=[])

def test_instrument_uninstrument(self):
instrumentation = CassandraInstrumentor()
instrumentation.instrument()
Expand All @@ -67,7 +71,7 @@ def test_instrumentor(
):
mock_create_response_future.return_value = mock.Mock()
mock_session_init.return_value = None
mock_connect.return_value = cassandra.cluster.Session()
mock_connect.return_value = self._mocked_session

CassandraInstrumentor().instrument()

Expand Down Expand Up @@ -100,7 +104,7 @@ def test_custom_tracer_provider(
):
mock_create_response_future.return_value = mock.Mock()
mock_session_init.return_value = None
mock_connect.return_value = cassandra.cluster.Session()
mock_connect.return_value = self._mocked_session

resource = resources.Resource.create({})
result = self.create_tracer_provider(resource=resource)
Expand All @@ -124,7 +128,7 @@ def test_instrument_connection_no_op_tracer_provider(
):
mock_create_response_future.return_value = mock.Mock()
mock_session_init.return_value = None
mock_connect.return_value = cassandra.cluster.Session()
mock_connect.return_value = self._mocked_session

tracer_provider = trace_api.NoOpTracerProvider()
CassandraInstrumentor().instrument(tracer_provider=tracer_provider)
Expand Down
Loading