MCPcopy Create free account
hub / github.com/AgentOps-AI/agentops / test_legacy_end_session_compatibility

Function test_legacy_end_session_compatibility

tests/unit/test_session.py:261–279  ·  view source on GitHub ↗

Test that legacy end_session still works and calls tracer.end_trace

(mock_tracing_core, mock_api_client, mock_trace_context, reset_client)

Source from the content-addressed store, hash-verified

259
260
261def test_legacy_end_session_compatibility(mock_tracing_core, mock_api_client, mock_trace_context, reset_client):
262 """Test that legacy end_session still works and calls tracer.end_trace"""
263 import agentops
264 from agentops.legacy import Session
265
266 # Initialize AgentOps
267 agentops.init(api_key="test-api-key", auto_start_session=False)
268
269 # Reset the call count to start fresh
270 mock_tracing_core.reset_mock()
271
272 # Create a legacy session object
273 session = Session(mock_trace_context)
274
275 # End the session
276 agentops.end_session(session)
277
278 # Verify that tracer.end_trace was called
279 mock_tracing_core.end_trace.assert_called_once_with(mock_trace_context, end_state="Success")
280
281
282def test_no_double_init(mock_tracing_core, mock_api_client, reset_client):

Callers

nothing calls this directly

Calls 3

SessionClass · 0.90
initMethod · 0.80
end_sessionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…