diff options
author | Chayim <chayim@users.noreply.github.com> | 2021-11-10 15:54:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-10 15:54:46 +0200 |
commit | 5be96b96d6059a61d0fd50f96a32db99975408ed (patch) | |
tree | a9c6d6c49b67211f115c40cb4ca67ab40d84d99a /tests/test_connection_pool.py | |
parent | 776dd5938a511052d5ce586dce66ac3508fc2e0e (diff) | |
download | redis-py-5be96b96d6059a61d0fd50f96a32db99975408ed.tar.gz |
Unit test fixes to carry pytest options through all tests (#1696)
Diffstat (limited to 'tests/test_connection_pool.py')
-rw-r--r-- | tests/test_connection_pool.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/test_connection_pool.py b/tests/test_connection_pool.py index 8d2ad04..6fedec6 100644 --- a/tests/test_connection_pool.py +++ b/tests/test_connection_pool.py @@ -44,14 +44,14 @@ class TestConnectionPool: assert connection.kwargs == connection_kwargs def test_multiple_connections(self, master_host): - connection_kwargs = {'host': master_host} + connection_kwargs = {'host': master_host[0], 'port': master_host[1]} pool = self.get_pool(connection_kwargs=connection_kwargs) c1 = pool.get_connection('_') c2 = pool.get_connection('_') assert c1 != c2 def test_max_connections(self, master_host): - connection_kwargs = {'host': master_host} + connection_kwargs = {'host': master_host[0], 'port': master_host[1]} pool = self.get_pool(max_connections=2, connection_kwargs=connection_kwargs) pool.get_connection('_') @@ -60,7 +60,7 @@ class TestConnectionPool: pool.get_connection('_') def test_reuse_previously_released_connection(self, master_host): - connection_kwargs = {'host': master_host} + connection_kwargs = {'host': master_host[0], 'port': master_host[1]} pool = self.get_pool(connection_kwargs=connection_kwargs) c1 = pool.get_connection('_') pool.release(c1) @@ -103,14 +103,15 @@ class TestBlockingConnectionPool: return pool def test_connection_creation(self, master_host): - connection_kwargs = {'foo': 'bar', 'biz': 'baz', 'host': master_host} + connection_kwargs = {'foo': 'bar', 'biz': 'baz', + 'host': master_host[0], 'port': master_host[1]} pool = self.get_pool(connection_kwargs=connection_kwargs) connection = pool.get_connection('_') assert isinstance(connection, DummyConnection) assert connection.kwargs == connection_kwargs def test_multiple_connections(self, master_host): - connection_kwargs = {'host': master_host} + connection_kwargs = {'host': master_host[0], 'port': master_host[1]} pool = self.get_pool(connection_kwargs=connection_kwargs) c1 = pool.get_connection('_') c2 = pool.get_connection('_') @@ -118,7 +119,7 @@ class TestBlockingConnectionPool: def test_connection_pool_blocks_until_timeout(self, master_host): "When out of connections, block for timeout seconds, then raise" - connection_kwargs = {'host': master_host} + connection_kwargs = {'host': master_host[0], 'port': master_host[1]} pool = self.get_pool(max_connections=1, timeout=0.1, connection_kwargs=connection_kwargs) pool.get_connection('_') @@ -134,7 +135,7 @@ class TestBlockingConnectionPool: When out of connections, block until another connection is released to the pool """ - connection_kwargs = {'host': master_host} + connection_kwargs = {'host': master_host[0], 'port': master_host[1]} pool = self.get_pool(max_connections=1, timeout=2, connection_kwargs=connection_kwargs) c1 = pool.get_connection('_') @@ -149,7 +150,7 @@ class TestBlockingConnectionPool: assert time.time() - start >= 0.1 def test_reuse_previously_released_connection(self, master_host): - connection_kwargs = {'host': master_host} + connection_kwargs = {'host': master_host[0], 'port': master_host[1]} pool = self.get_pool(connection_kwargs=connection_kwargs) c1 = pool.get_connection('_') pool.release(c1) |