Test that legacy start_session still works and calls tracer.start_trace
(mock_tracing_core, mock_api_client, mock_trace_context, reset_client)
| 233 | |
| 234 | |
| 235 | def test_legacy_start_session_compatibility(mock_tracing_core, mock_api_client, mock_trace_context, reset_client): |
| 236 | """Test that legacy start_session still works and calls tracer.start_trace""" |
| 237 | import agentops |
| 238 | from agentops.legacy import Session |
| 239 | |
| 240 | # Initialize AgentOps |
| 241 | agentops.init(api_key="test-api-key", auto_start_session=False) |
| 242 | |
| 243 | # Reset the call count to start fresh |
| 244 | mock_tracing_core.reset_mock() |
| 245 | # Mock the start_trace method |
| 246 | mock_tracing_core.start_trace.return_value = mock_trace_context |
| 247 | |
| 248 | # Start a legacy session |
| 249 | session = agentops.start_session(tags=["legacy_test"]) |
| 250 | |
| 251 | # Verify the session was created |
| 252 | assert isinstance(session, Session) |
| 253 | # Check that the session's trace_context has the expected properties |
| 254 | assert session.trace_context is not None |
| 255 | |
| 256 | # Verify that tracer.start_trace was called |
| 257 | # Note: May be called multiple times due to initialization |
| 258 | assert mock_tracing_core.start_trace.call_count >= 1 |
| 259 | |
| 260 | |
| 261 | def test_legacy_end_session_compatibility(mock_tracing_core, mock_api_client, mock_trace_context, reset_client): |
nothing calls this directly
no test coverage detected
searching dependent graphs…