Make thread safety tests faster
This commit is contained in:
parent
4cbf49167b
commit
48b52b76f2
|
@ -782,8 +782,10 @@ def test_assisted_builder_injection_uses_the_same_binding_key_every_time():
|
|||
|
||||
class TestThreadSafety(object):
|
||||
def setup(self):
|
||||
self.event = threading.Event()
|
||||
|
||||
def configure(binder):
|
||||
binder.bind(str, to=lambda: sleep(1) and 'this is str')
|
||||
binder.bind(str, to=lambda: self.event.wait() and 'this is str')
|
||||
|
||||
class XXX(object):
|
||||
@inject(s=str)
|
||||
|
@ -807,6 +809,8 @@ class TestThreadSafety(object):
|
|||
for t in threads:
|
||||
t.start()
|
||||
|
||||
self.event.set()
|
||||
|
||||
for t in threads:
|
||||
t.join()
|
||||
|
||||
|
|
Loading…
Reference in New Issue