예제 #1
0
 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.")
예제 #2
0
    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()
예제 #3
0
 def test_isLocked(self):
     queue = WishboneQueue()
     queue.getLock()
     assert queue.isLocked() == (True, False)