mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make the max time for the contention test 20s
This commit is contained in:
parent
4a7d673585
commit
fa9b0a7e97
@ -171,10 +171,24 @@ class TestLock(BaseTest):
|
||||
for t in threads:
|
||||
t.daemon = True
|
||||
t.start()
|
||||
end_at = time.monotonic() + 20
|
||||
for t in threads:
|
||||
t.join(20)
|
||||
left = end_at - time.monotonic()
|
||||
if left <= 0:
|
||||
break
|
||||
t.join(left)
|
||||
live = [t for t in threads if t.is_alive()]
|
||||
self.assertListEqual(live, [], 'ShLock hung')
|
||||
self.assertEqual(len(live), 0, 'ShLock hung, {} threads alive'.format(len(live)))
|
||||
self.assertEqual(len(done), len(threads), 'SHLock locking failed')
|
||||
self.assertFalse(lock.is_shared)
|
||||
self.assertFalse(lock.is_exclusive)
|
||||
|
||||
|
||||
def find_tests():
|
||||
import unittest
|
||||
return unittest.defaultTestLoader.loadTestsFromTestCase(TestLock)
|
||||
|
||||
|
||||
def run_tests():
|
||||
from calibre.utils.run_tests import run_tests
|
||||
run_tests(find_tests)
|
||||
|
Loading…
x
Reference in New Issue
Block a user