diff --git a/requirements/test-ci.txt b/requirements/test-ci.txt index e3dad2c1..e9b7227f 100644 --- a/requirements/test-ci.txt +++ b/requirements/test-ci.txt @@ -15,3 +15,4 @@ urllib3>=1.26.16; sys_platform != 'win32' -r extras/brotli.txt -r extras/zstd.txt -r extras/sqlalchemy.txt +-r extras/etcd.txt diff --git a/t/unit/transport/test_etcd.py b/t/unit/transport/test_etcd.py index 1eadda51..11039e40 100644 --- a/t/unit/transport/test_etcd.py +++ b/t/unit/transport/test_etcd.py @@ -1,5 +1,6 @@ from __future__ import annotations +from array import array from queue import Empty from unittest.mock import Mock, patch @@ -14,9 +15,11 @@ class test_Etcd: def setup_method(self): self.connection = Mock() + self.connection._used_channel_ids = array('H') + self.connection.channel_max = 65535 self.connection.client.transport_options = {} self.connection.client.port = 2739 - self.client = self.patch('etcd.Client').return_value + self.client = self.patching('etcd.Client').return_value self.channel = Channel(connection=self.connection) def test_driver_version(self): @@ -42,26 +45,26 @@ class test_Etcd: queue = 'mynewqueue' with patch('etcd.Lock'): - self.client.write.return_value = self.patch('etcd.EtcdResult') + self.client.write.return_value = self.patching('etcd.EtcdResult') assert self.channel._new_queue(queue) - self.client.delete.return_value = self.patch('etcd.EtcdResult') + self.client.delete.return_value = self.patching('etcd.EtcdResult') self.channel._delete(queue) def test_size(self): with patch('etcd.Lock'): - self.client.read.return_value = self.patch( + self.client.read.return_value = self.patching( 'etcd.EtcdResult', _children=[{}, {}]) assert self.channel._size('q') == 2 def test_get(self): with patch('etcd.Lock'): - self.client.read.return_value = self.patch( + self.client.read.return_value = self.patching( 'etcd.EtcdResult', _children=[{'key': 'myqueue', 'modifyIndex': 1, 'value': '1'}]) assert self.channel._get('myqueue') is not None def test_put(self): with patch('etcd.Lock'): - self.client.write.return_value = self.patch('etcd.EtcdResult') + self.client.write.return_value = self.patching('etcd.EtcdResult') assert self.channel._put('myqueue', 'mydata') is None