

def test():
    started = Queue()
    n = 1000
    threads = []
    touched = []
    pool = EmptyListPool()
    rand = SystemRandom()

    def _run():
        psleep = rand.uniform(0.05, 0.1)
        with pool.transaction() as a:
            started.put(1)
            started.join()
            a.append(rand.uniform(0, 1))
            if (psleep > 1):
                print(psleep)
            sleep(psleep)
    for i in range(n):
        th = Thread(target=_run)
        threads.append(th)
        th.start()
    for i in range(n):
        started.get()
        started.task_done()
    for element in pool:
        touched.append(element)
    for thr in threads:
        thr.join()
    if (set(pool.elements) != set(touched)):
        print((set(pool.elements) - set(touched)))
        return False
    else:
        return True

dataset/ETHPy150Open basho/riak-python-client/riak/tests/pool-grinder.py test/original