def test_locked(self): lock = AssertingLock() with self.assertRaises(AssertionError): with lock: with lock: pass
def setUp(self): # Will raise if more then one thread try to enter the sampling method self.single_thread_allowed = AssertingLock() self.entered_sampling_method = threading.Event() self.results = ['result-1', 'result-2']
def test_free(self): lock = AssertingLock() with lock: pass