summaryrefslogtreecommitdiff
path: root/t/unit/test_connection.py
diff options
context:
space:
mode:
authorPaul Brown <paul90brown@gmail.com>2021-12-22 11:17:03 +0000
committerGitHub <noreply@github.com>2021-12-22 17:17:03 +0600
commit935a06b9506c7fa596863de3fc6f369ae1205bdc (patch)
treefaad44aa37de0b82b13de3e4a07307a58a2f41c6 /t/unit/test_connection.py
parent81d4072825b341c797beffae8e6c4e7ecf8ad71d (diff)
downloadpy-amqp-935a06b9506c7fa596863de3fc6f369ae1205bdc.tar.gz
improve performance of _get_free_channel_id, fix channel max bug (#385)
* improve performance of _get_free_channel_id, fix channel max bug * add integration tests for _get_free_channel_id performance improvement
Diffstat (limited to 't/unit/test_connection.py')
-rw-r--r--t/unit/test_connection.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/t/unit/test_connection.py b/t/unit/test_connection.py
index dfa9a74..13eb0b6 100644
--- a/t/unit/test_connection.py
+++ b/t/unit/test_connection.py
@@ -352,8 +352,10 @@ class test_Connection:
assert self.conn._get_free_channel_id() == 1
assert self.conn._get_free_channel_id() == 2
- def test_get_free_channel_id__raises_IndexError(self):
- self.conn._used_channel_ids = array('H', range(1, self.conn.channel_max))
+ def test_get_free_channel_id__raises_ResourceError(self):
+ self.conn.channel_max = 2
+ self.conn._get_free_channel_id()
+ self.conn._get_free_channel_id()
with pytest.raises(ResourceError):
self.conn._get_free_channel_id()