unit test for Semaphore

A small issue here. Because you have no guarantee when the shutdown is going to be called. It could be that it is called after you did the acquire and therefor sometimes you test fails from time to time.

Why do you call the shutdown on another thread? 

Why not:

hz.shutdown()
semaphore.acquire()