Setup AgentOps with mock API key.
(mock_api_key)
| 29 | |
| 30 | @pytest.fixture(autouse=True) |
| 31 | def setup_agentops(mock_api_key): |
| 32 | """Setup AgentOps with mock API key.""" |
| 33 | # Reset client singleton |
| 34 | Client._Client__instance = None |
| 35 | |
| 36 | # Mock the API client to avoid real authentication |
| 37 | with patch("agentops.client.client.ApiClient") as mock_api_client: |
| 38 | # Create mock API instance |
| 39 | mock_api = MagicMock() |
| 40 | mock_api.v3.fetch_auth_token.return_value = {"token": "mock_token", "project_id": "mock_project_id"} |
| 41 | mock_api_client.return_value = mock_api |
| 42 | |
| 43 | # Mock global tracer to avoid actual initialization |
| 44 | with patch("agentops.tracer") as mock_tracer: |
| 45 | mock_tracer.initialized = True |
| 46 | |
| 47 | agentops.init(api_key=mock_api_key, auto_start_session=True) |
| 48 | yield |
| 49 | |
| 50 | try: |
| 51 | agentops.end_all_sessions() |
| 52 | except: |
| 53 | pass |
| 54 | |
| 55 | # Clean up client singleton |
| 56 | Client._Client__instance = None |
| 57 | |
| 58 | |
| 59 | def test_concurrent_api_requests(client): |
nothing calls this directly
no test coverage detected
searching dependent graphs…