@@ -98,16 +98,6 @@ def mock_init(self, **kwargs):
9898 def langfuse_client (self , monkeypatch , tracer_provider , mock_processor_init ):
9999 """Create a mocked Langfuse client for testing."""
100100
101- # Mock project ID fetching
102- def mock_fetch (self ):
103- self ._project_id = "test-project-id"
104- self ._project_id_fetched .set ()
105-
106- monkeypatch .setattr (
107- "langfuse._client.resource_manager.LangfuseResourceManager._fetch_project_id_background" ,
108- mock_fetch ,
109- )
110-
111101 # Set environment variables
112102 monkeypatch .setenv ("LANGFUSE_PUBLIC_KEY" , "test-public-key" )
113103 monkeypatch .setenv ("LANGFUSE_SECRET_KEY" , "test-secret-key" )
@@ -121,8 +111,6 @@ def mock_fetch(self):
121111 )
122112
123113 # Configure client for testing
124- client ._resources ._project_id = "test-project-id"
125- client ._resources ._project_id_fetched .set ()
126114 client ._otel_tracer = tracer_provider .get_tracer ("langfuse-test" )
127115
128116 yield client
@@ -134,16 +122,6 @@ def configurable_langfuse_client(
134122 """Create a Langfuse client fixture that allows configuration parameters."""
135123
136124 def _create_client (** kwargs ):
137- # Mock project ID fetching
138- def mock_fetch (self ):
139- self ._project_id = "test-project-id"
140- self ._project_id_fetched .set ()
141-
142- monkeypatch .setattr (
143- "langfuse._client.resource_manager.LangfuseResourceManager._fetch_project_id_background" ,
144- mock_fetch ,
145- )
146-
147125 # Set environment variables
148126 monkeypatch .setenv ("LANGFUSE_PUBLIC_KEY" , "test-public-key" )
149127 monkeypatch .setenv ("LANGFUSE_SECRET_KEY" , "test-secret-key" )
@@ -158,8 +136,6 @@ def mock_fetch(self):
158136 )
159137
160138 # Configure client
161- client ._resources ._project_id = "test-project-id"
162- client ._resources ._project_id_fetched .set ()
163139 client ._otel_tracer = tracer_provider .get_tracer ("langfuse-test" )
164140
165141 return client
@@ -860,17 +836,6 @@ def test_updating_current_generation(self, langfuse_client, memory_exporter):
860836
861837 def test_sampling (self , monkeypatch , tracer_provider , mock_processor_init ):
862838 """Test sampling behavior."""
863-
864- # Create a client with a sample rate of 0 (no sampling)
865- def mock_fetch (self ):
866- self ._project_id = "test-project-id"
867- self ._project_id_fetched .set ()
868-
869- monkeypatch .setattr (
870- "langfuse._client.resource_manager.LangfuseResourceManager._fetch_project_id_background" ,
871- mock_fetch ,
872- )
873-
874839 # Create a new memory exporter for this test
875840 sampled_exporter = InMemorySpanExporter ()
876841
@@ -1453,16 +1418,6 @@ def multi_project_setup(self, monkeypatch):
14531418 project1_key = f"proj1_{ unique_suffix } "
14541419 project2_key = f"proj2_{ unique_suffix } "
14551420
1456- # Mock project ID fetching
1457- def mock_fetch (self ):
1458- self ._project_id = "test-project-id"
1459- self ._project_id_fetched .set ()
1460-
1461- monkeypatch .setattr (
1462- "langfuse._client.resource_manager.LangfuseResourceManager._fetch_project_id_background" ,
1463- mock_fetch ,
1464- )
1465-
14661421 # Clear singleton instances to avoid cross-test contamination
14671422 monkeypatch .setattr (LangfuseResourceManager , "_instances" , {})
14681423
@@ -2426,17 +2381,6 @@ class TestOtelIdGeneration:
24262381 @pytest .fixture
24272382 def langfuse_client (self , monkeypatch ):
24282383 """Create a minimal Langfuse client for testing ID generation functions."""
2429-
2430- # Mock project ID fetching to avoid network calls
2431- def mock_fetch (self ):
2432- self ._project_id = "test-project-id"
2433- self ._project_id_fetched .set ()
2434-
2435- monkeypatch .setattr (
2436- "langfuse._client.resource_manager.LangfuseResourceManager._fetch_project_id_background" ,
2437- mock_fetch ,
2438- )
2439-
24402384 client = Langfuse (
24412385 public_key = "test-public-key" ,
24422386 secret_key = "test-secret-key" ,
0 commit comments