diff --git a/injector_test.py b/injector_test.py index 0a00e94..1f835eb 100644 --- a/injector_test.py +++ b/injector_test.py @@ -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()