def test_singleton_pool_threadlocal(self):
        """Should be the same as non-threadlocal."""
        listener = _TestListener()
        pool = SingletonThreadPool(keyspace='Keyspace1',
                         credentials=_credentials, pool_size=5,
                         listeners=[listener], use_threadlocal=True)

        # Make sure we get the same connection every time
        conn = pool.get()
        assert_equal(pool.get(), conn)
        for i in range(10):
            conn = pool.get()
        assert_equal(listener.connect_count, 1)

        pool.return_conn(conn)

        conn = pool.get()
        assert_equal(pool.get(), conn)
        assert_equal(listener.connect_count, 2)
        pool.return_conn(conn)

        def get_return():
            conn = pool.get()
            print pool.status()

        threads = []
        for i in range(5):
            threads.append(threading.Thread(target=get_return))
            threads[-1].start()
        for thread in threads:
            thread.join()
        assert_equal(listener.connect_count, 7)

        assert_raises(NoConnectionAvailable, pool.get)
        assert_equal(listener.max_count, 1)