Make the test a little more robust

This commit is contained in:
Kovid Goyal 2018-01-27 20:42:47 +05:30
parent cba932362f
commit a24f108906
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -136,6 +136,10 @@ class IPCLockTest(unittest.TestCase):
tdirs = [] tdirs = []
while not tdirs: while not tdirs:
tdirs = list(tdirs_in('t', check_for_lock=True)) tdirs = list(tdirs_in('t', check_for_lock=True))
for i in range(5):
if is_tdir_locked(tdirs[0]):
break
time.sleep(1)
self.assertTrue(is_tdir_locked(tdirs[0])) self.assertTrue(is_tdir_locked(tdirs[0]))
c2 = run_worker('calibre.utils.test_lock', 'other5') c2 = run_worker('calibre.utils.test_lock', 'other5')
c2.wait() c2.wait()