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

Function setup_agentops

tests/integration/test_session_concurrency.py:31–56  ·  view source on GitHub ↗

Setup AgentOps with mock API key.

(mock_api_key)

Source from the content-addressed store, hash-verified

29
30@pytest.fixture(autouse=True)
31def 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
59def test_concurrent_api_requests(client):

Callers

nothing calls this directly

Calls 1

initMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…