@@ -2513,7 +2513,10 @@ def test_load_feature_flags_clears_etag_when_server_stops_sending(
25132513 self .assertIsNone (client ._flags_etag )
25142514 self .assertEqual (client .feature_flags [0 ]["key" ], "flag-v2" )
25152515
2516- def test_load_feature_flags_wrong_key (self ):
2516+ @mock .patch ("posthog.client.Poller" )
2517+ @mock .patch ("posthog.client.get" )
2518+ def test_load_feature_flags_wrong_key (self , patch_get , _patch_poll ):
2519+ patch_get .side_effect = APIError (401 , "Unauthorized" )
25172520 client = Client (FAKE_TEST_API_KEY , personal_api_key = FAKE_TEST_API_KEY )
25182521
25192522 with self .assertLogs ("posthog" , level = "ERROR" ) as logs :
@@ -4266,13 +4269,15 @@ def test_disable_geoip_get_flag_capture_call(self, patch_flags, patch_capture):
42664269 disable_geoip = False ,
42674270 )
42684271
4269- @mock .patch ("posthog.client.MAX_DICT_SIZE" , 100 )
42704272 @mock .patch .object (Client , "capture" )
42714273 @mock .patch ("posthog.client.flags" )
42724274 def test_capture_multiple_users_doesnt_out_of_memory (
42734275 self , patch_flags , patch_capture
42744276 ):
42754277 client = Client (FAKE_TEST_API_KEY , personal_api_key = FAKE_TEST_API_KEY )
4278+ # Set on the instance to avoid relying on module-constant patching behavior
4279+ # across Python/runtime implementations.
4280+ client .distinct_ids_feature_flags_reported .max_size = 100
42764281 client .feature_flags = [
42774282 {
42784283 "id" : 1 ,
0 commit comments