Skip to content

Commit

Permalink
Use _run_lock instead of time.sleep in testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyseek committed Jul 29, 2016
1 parent 6fd5062 commit b742888
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion kazoo/tests/test_watchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,15 @@ def changed(children):

# delete watching
self.client.delete(path)
time.sleep(1)

# a hack for waiting the watcher stop
for retry in range(5):
if children_watch._stopped:
break
children_watch._run_lock.acquire()
children_watch._run_lock.release()
time.sleep(retry / 10.0)

eq_(update.is_set(), False)
eq_(children_watch._stopped, True)

Expand Down

0 comments on commit b742888

Please sign in to comment.