Make thread safety tests faster

This commit is contained in:
Jakub Stasiak 2013-06-11 16:00:48 +01:00
parent 4cbf49167b
commit 48b52b76f2
1 changed files with 5 additions and 1 deletions

View File

@ -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()