@@ -127,7 +127,8 @@ def test_rerun(self):
127127 cache_policy = ConfigService ('' , PollingMode .auto_poll (poll_interval_seconds = 2 ,
128128 max_init_wait_time_seconds = 5 ),
129129 Hooks (), config_fetcher , log , config_cache , False )
130- time .sleep (2.200 )
130+ wait_tolerance = 0.4
131+ time .sleep (2 + wait_tolerance )
131132 self .assertEqual (config_fetcher .get_call_count , 2 )
132133 cache_policy .close ()
133134
@@ -142,13 +143,14 @@ def test_callback(self):
142143 max_init_wait_time_seconds = 5 ),
143144 hooks , config_fetcher , log , config_cache , False )
144145 time .sleep (1 )
146+ wait_tolerance = 0.3
145147 self .assertEqual (config_fetcher .get_call_count , 1 )
146148 self .assertEqual (hook_callbacks .changed_config_call_count , 1 )
147- time .sleep (1.2 )
149+ time .sleep (1 + wait_tolerance )
148150 self .assertEqual (config_fetcher .get_call_count , 2 )
149151 self .assertEqual (hook_callbacks .changed_config_call_count , 1 )
150152 config_fetcher .set_configuration_json (TEST_JSON2 )
151- time .sleep (2.2 )
153+ time .sleep (2 + wait_tolerance )
152154 self .assertEqual (config_fetcher .get_call_count , 3 )
153155 self .assertEqual (hook_callbacks .changed_config_call_count , 2 )
154156 cache_policy .close ()
@@ -163,14 +165,15 @@ def test_callback_exception(self):
163165 cache_policy = ConfigService ('' , PollingMode .auto_poll (poll_interval_seconds = 2 ,
164166 max_init_wait_time_seconds = 5 ),
165167 hooks , config_fetcher , log , config_cache , False )
168+ wait_tolerance = 0.4
166169 time .sleep (1 )
167170 self .assertEqual (config_fetcher .get_call_count , 1 )
168171 self .assertEqual (hook_callbacks .callback_exception_call_count , 1 )
169- time .sleep (1.2 )
172+ time .sleep (1 + wait_tolerance )
170173 self .assertEqual (config_fetcher .get_call_count , 2 )
171174 self .assertEqual (hook_callbacks .callback_exception_call_count , 1 )
172175 config_fetcher .set_configuration_json (TEST_JSON2 )
173- time .sleep (2.2 )
176+ time .sleep (2 + wait_tolerance )
174177 self .assertEqual (config_fetcher .get_call_count , 3 )
175178 self .assertEqual (hook_callbacks .callback_exception_call_count , 2 )
176179 cache_policy .close ()
@@ -233,7 +236,8 @@ def test_return_cached_config_when_cache_is_not_expired(self):
233236 self .assertEqual (config_fetcher .get_call_count , 0 )
234237 self .assertEqual (config_fetcher .get_fetch_count , 0 )
235238
236- time .sleep (3 )
239+ wait_tolerance = 0.1
240+ time .sleep (3 + wait_tolerance )
237241
238242 config , _ = cache_policy .get_config ()
239243 settings = config .get (FEATURE_FLAGS )
0 commit comments