def test_getLock(self): queue = WishboneQueue() queue.put("test") queue.getLock() try: queue.get() except QueueLocked: pass else: raise AssertionError ("Queue getLock does not seem to have the desired effect.")
def test_waitUntilGetAllowed(self): from gevent import spawn, sleep def go(queue): queue.waitUntilGetAllowed() queue = WishboneQueue() queue.put("test") queue.getLock() instance=spawn(go, queue) sleep() assert not instance.ready() queue.getUnlock() sleep() assert instance.ready()
def test_isLocked(self): queue = WishboneQueue() queue.getLock() assert queue.isLocked() == (True, False)