stephenmcd/hot-redis — pull request #6 by bluele (2014-07-07 11:53:43+00:00)
Title: Fix BoundedSemaphore.release method and Add Tests for Lock, BoundedSemaphore, Semaphore.

Hi!
`BoundedSemaphore.release` method always fails when is it called more than once.
Here's an example.

In [1]: import hot_redis
In [2]: sem = hot_redis.BoundedSemaphore(value=2)
In [3]: sem.acquire()
Out[3]: True
In [4]: sem.acquire()
Out[4]: True
In [5]: sem.release()
In [6]: sem.release() # the second calling release method failed.
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
in ()
----> 1 sem.release()

/Users/bluele/.virtualenvs/hot_redis_master/lib/python2.7/site-packages/hot_redis/types.pyc in release(self)
704 def release(self):
705 if not getattr(self, "acquired", False):
--> 706 raise RuntimeError("Cannot release unacquired lock")
707 self.acquired = False
708

This pull-request fixed the above problem and added test code for Lock, BoundedSemaphore, Semaphore.