Skip to content

Commit 2016924

Browse files
committed
Use _run_lock instead of time.sleep in testing.
https://github.com/python-zk/kazoo/pull/393/files#r72820385
1 parent 6fd5062 commit 2016924

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

kazoo/tests/test_watchers.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,15 @@ def changed(children):
207207

208208
# delete watching
209209
self.client.delete(path)
210-
time.sleep(1)
210+
211+
# a hack for waiting the watcher stop
212+
for retry in range(5):
213+
if children_watch._stopped:
214+
break
215+
children_watch._run_lock.acquire()
216+
children_watch._run_lock.release()
217+
time.sleep(retry / 10.0)
218+
211219
eq_(update.is_set(), False)
212220
eq_(children_watch._stopped, True)
213221

0 commit comments

Comments
 (0)