Skip to content

Commit

Permalink
Merge pull request #7 from chrismcguire/pool-close-fixes
Browse files Browse the repository at this point in the history
Pool close fixes
  • Loading branch information
gmr committed Jan 9, 2015
2 parents 9a4f4ab + f4ed482 commit d9a3b91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion queries/pool.py
Expand Up @@ -156,7 +156,7 @@ def clean(self):

def close(self):
"""Close the pool by closing and removing all of the connections"""
for cid in self.connections:
for cid in self.connections.keys():
self.remove(self.connections[cid].handle)
LOGGER.debug('Pool %s closed', self.id)

Expand Down
3 changes: 2 additions & 1 deletion tests/pool_tests.py
Expand Up @@ -108,7 +108,8 @@ def test_close_close_removes_all(self):
psycopg2_conns = [mock.Mock(), mock.Mock()]
[obj.add(conn) for conn in psycopg2_conns]
obj.close()
obj.remove.assert_hass_calls(psycopg2_conns)
psycopg2_calls = [mock.call(c) for c in psycopg2_conns]
obj.remove.assert_has_calls(psycopg2_calls)

def test_free_invokes_connection_free(self):
obj = pool.Pool(str(uuid.uuid4()))
Expand Down

0 comments on commit d9a3b91

Please sign in to comment.