Skip to content

Commit

Permalink
Adding un-implemented ConnectionPool.connection.
Browse files Browse the repository at this point in the history
Simply added to match interface, implementation will be forthcoming.
  • Loading branch information
dhermes committed Sep 4, 2015
1 parent 8232abe commit 480d5d1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions gcloud_bigtable/happybase/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,18 @@ def __init__(self, size, **kwargs):
for _ in xrange(size):
connection = Connection(**connection_kwargs)
self._queue.put(connection)

def connection(self, timeout=None):
"""Obtain a connection from the pool.
Intended to be used as a context manager, but not implemented with
that functionality yet.
:type timeout: int
:param timeout: (Optional) Time (in seconds) to wait for a connection
to open.
:raises: :class:`NotImplementedError <exceptions.NotImplementedError>`
temporarily until the method is implemented.
"""
raise NotImplementedError('Temporarily not implemented.')
7 changes: 7 additions & 0 deletions gcloud_bigtable/happybase/test_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,10 @@ def test_constructor_non_positive_size(self):
size = 0
with self.assertRaises(ValueError):
self._makeOne(size)

def test_connection(self):
size = 1
timeout = 10
pool = self._makeOne(size)
with self.assertRaises(NotImplementedError):
pool.connection(timeout=timeout)

0 comments on commit 480d5d1

Please sign in to comment.