Merge lp:~free.ekanayaka/txamqp/distinguish-channel-and-connection-errors into lp:txamqp

Proposed by Free Ekanayaka
Status: Merged
Merged at revision: 77
Proposed branch: lp:~free.ekanayaka/txamqp/distinguish-channel-and-connection-errors
Merge into: lp:txamqp
Diff against target: 450 lines (+129/-34)
8 files modified
setup.py (+1/-1)
src/txamqp/client.py (+22/-1)
src/txamqp/protocol.py (+13/-4)
src/txamqp/test/test_basic.py (+23/-7)
src/txamqp/test/test_broker.py (+3/-3)
src/txamqp/test/test_exchange.py (+26/-5)
src/txamqp/test/test_protocol.py (+29/-1)
src/txamqp/test/test_queue.py (+12/-12)
To merge this branch: bzr merge lp:~free.ekanayaka/txamqp/distinguish-channel-and-connection-errors
Reviewer Review Type Date Requested Status
Alberto Donato (community) Approve
Review via email: mp+311633@code.launchpad.net

Description of the change

Sub-class the generic txamqp.client.Closed error so it's easier to consuming code to distinguish between AMQP "channel" errors and "connection" errors (they have different semantics and happen under different circumstances, so you want to typically handle them differently).

Note that these are protocol-level errors, non transport-level ones (i.e. the TCP connection is still open after they happen).

While at it, some try/except blocks were migrated to py3-compatible syntax ("Exception, e:" vs "Exception as e:").

To post a comment you must log in.
90. By Free Ekanayaka

Use py3-compatible try/except syntax

Revision history for this message
Alberto Donato (ack) wrote :

nice, +1

just a few nits inline

review: Approve
Revision history for this message
Free Ekanayaka (free.ekanayaka) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'setup.py'
--- setup.py 2013-03-03 13:40:48 +0000
+++ setup.py 2016-11-23 16:38:57 +0000
@@ -1,6 +1,6 @@
1setupdict= {1setupdict= {
2 'name': 'txAMQP',2 'name': 'txAMQP',
3 'version': '0.6.2',3 'version': '0.7.0',
4 'author': 'Esteve Fernandez',4 'author': 'Esteve Fernandez',
5 'author_email': 'esteve@fluidinfo.com',5 'author_email': 'esteve@fluidinfo.com',
6 'url': 'https://launchpad.net/txamqp',6 'url': 'https://launchpad.net/txamqp',
77
=== modified file 'src/txamqp/client.py'
--- src/txamqp/client.py 2016-06-06 07:09:04 +0000
+++ src/txamqp/client.py 2016-11-23 16:38:57 +0000
@@ -2,12 +2,33 @@
2from twisted.internet import defer2from twisted.internet import defer
3from txamqp.delegate import Delegate3from txamqp.delegate import Delegate
44
5
5class Closed(Exception):6class Closed(Exception):
6 pass7 """Raised if either a channel or the whole connection got closed."""
8
9
10class ChannelClosed(Closed):
11 """Raised if a channel got closed because of a channel error.
12
13 This happens when the broker sends us a 'channel-close' method.
14
15 @see: The AMQP specification for possible channel error codes.
16 """
17
18
19class ConnectionClosed(Closed):
20 """Raised if the connection got closed because of a connection error.
21
22 This happens when the broker sends us a 'connection-close' method.
23
24 @see: The AMQP specification for possible connection error codes.
25 """
26
727
8class AlreadyFiredError(Exception):28class AlreadyFiredError(Exception):
9 pass29 pass
1030
31
11class TwistedEvent(object):32class TwistedEvent(object):
12 """33 """
13 An asynchronous event that is in one of three states:34 An asynchronous event that is in one of three states:
1435
=== modified file 'src/txamqp/protocol.py'
--- src/txamqp/protocol.py 2016-11-22 13:31:30 +0000
+++ src/txamqp/protocol.py 2016-11-23 16:38:57 +0000
@@ -10,7 +10,7 @@
10from txamqp.message import Message10from txamqp.message import Message
11from txamqp.content import Content11from txamqp.content import Content
12from txamqp.queue import TimeoutDeferredQueue, Closed as QueueClosed12from txamqp.queue import TimeoutDeferredQueue, Closed as QueueClosed
13from txamqp.client import TwistedEvent, Closed13from txamqp.client import TwistedEvent, Closed, ConnectionClosed, ChannelClosed
14from cStringIO import StringIO14from cStringIO import StringIO
15import struct15import struct
16from time import time16from time import time
@@ -66,7 +66,7 @@
66 @defer.inlineCallbacks66 @defer.inlineCallbacks
67 def invoke(self, method, args, content=None):67 def invoke(self, method, args, content=None):
68 if self.closed:68 if self.closed:
69 raise Closed(self.reason)69 self._raiseClosed(self.reason)
70 frame = Frame(self.id, Method(method, *args))70 frame = Frame(self.id, Method(method, *args))
71 self.outgoing.put(frame)71 self.outgoing.put(frame)
7272
@@ -96,7 +96,7 @@
96 raise ValueError(resp)96 raise ValueError(resp)
97 except QueueClosed, e:97 except QueueClosed, e:
98 if self.closed:98 if self.closed:
99 raise Closed(self.reason)99 self._raiseClosed(self.reason)
100 else:100 else:
101 raise e101 raise e
102102
@@ -112,6 +112,15 @@
112 chunk = content.body[i:i + maxChunkSize]112 chunk = content.body[i:i + maxChunkSize]
113 queue.put(Frame(self.id, Body(chunk)))113 queue.put(Frame(self.id, Body(chunk)))
114114
115 def _raiseClosed(self, reason):
116 """Raise the appropriate Closed-based error for the given reason."""
117 if isinstance(reason, Message):
118 if reason.method.klass.name == "channel":
119 raise ChannelClosed(reason)
120 elif reason.method.klass.name == "connection":
121 raise ConnectionClosed(reason)
122 raise Closed(reason)
123
115124
116class FrameReceiver(protocol.Protocol, basic._PauseableMixin):125class FrameReceiver(protocol.Protocol, basic._PauseableMixin):
117126
@@ -318,7 +327,7 @@
318 cleanly, by sending a "close" method and waiting for "close-ok". If327 cleanly, by sending a "close" method and waiting for "close-ok". If
319 no reply is received within the given amount of seconds, the328 no reply is received within the given amount of seconds, the
320 transport will be forcely shutdown.329 transport will be forcely shutdown.
321 """330 """
322 if self.closed:331 if self.closed:
323 return332 return
324333
325334
=== modified file 'src/txamqp/test/test_basic.py'
--- src/txamqp/test/test_basic.py 2016-06-08 13:10:58 +0000
+++ src/txamqp/test/test_basic.py 2016-11-23 16:38:57 +0000
@@ -16,10 +16,11 @@
16# specific language governing permissions and limitations16# specific language governing permissions and limitations
17# under the License.17# under the License.
18#18#
19from txamqp.client import Closed19from txamqp.client import ConnectionClosed, ChannelClosed
20from txamqp.queue import Empty20from txamqp.queue import Empty
21from txamqp.content import Content21from txamqp.content import Content
22from txamqp.testlib import TestBase, supportedBrokers, QPID, OPENAMQ22from txamqp.testlib import (
23 TestBase, supportedBrokers, QPID, OPENAMQ, RABBITMQ)
2324
24from twisted.internet.defer import inlineCallbacks25from twisted.internet.defer import inlineCallbacks
2526
@@ -68,7 +69,7 @@
68 try:69 try:
69 yield channel.basic_consume(consumer_tag="second", queue="test-queue-2")70 yield channel.basic_consume(consumer_tag="second", queue="test-queue-2")
70 self.fail("Expected consume request to fail due to previous exclusive consumer")71 self.fail("Expected consume request to fail due to previous exclusive consumer")
71 except Closed, e:72 except ChannelClosed as e:
72 self.assertChannelException(403, e.args[0])73 self.assertChannelException(403, e.args[0])
7374
74 #open new channel and cleanup last consumer:75 #open new channel and cleanup last consumer:
@@ -80,7 +81,7 @@
80 try:81 try:
81 yield channel.basic_consume(consumer_tag="second", queue="test-queue-2", exclusive=True)82 yield channel.basic_consume(consumer_tag="second", queue="test-queue-2", exclusive=True)
82 self.fail("Expected exclusive consume request to fail due to previous consumer")83 self.fail("Expected exclusive consume request to fail due to previous consumer")
83 except Closed, e:84 except ChannelClosed as e:
84 self.assertChannelException(403, e.args[0])85 self.assertChannelException(403, e.args[0])
8586
86 @inlineCallbacks87 @inlineCallbacks
@@ -94,7 +95,7 @@
94 #queue specified but doesn't exist:95 #queue specified but doesn't exist:
95 yield channel.basic_consume(queue="invalid-queue")96 yield channel.basic_consume(queue="invalid-queue")
96 self.fail("Expected failure when consuming from non-existent queue")97 self.fail("Expected failure when consuming from non-existent queue")
97 except Closed, e:98 except ChannelClosed as e:
98 self.assertChannelException(404, e.args[0])99 self.assertChannelException(404, e.args[0])
99100
100 @supportedBrokers(QPID, OPENAMQ)101 @supportedBrokers(QPID, OPENAMQ)
@@ -109,9 +110,24 @@
109 #queue not specified and none previously declared for channel:110 #queue not specified and none previously declared for channel:
110 yield channel.basic_consume(queue="")111 yield channel.basic_consume(queue="")
111 self.fail("Expected failure when consuming from unspecified queue")112 self.fail("Expected failure when consuming from unspecified queue")
112 except Closed, e:113 except ConnectionClosed, e:
113 self.assertConnectionException(530, e.args[0])114 self.assertConnectionException(530, e.args[0])
114115
116 @supportedBrokers(RABBITMQ)
117 @inlineCallbacks
118 def test_consume_queue_unspecified_rabbit(self):
119 """
120 C{basic_consume} fails with a channel exception with a C{404} code
121 when no queue is specified.
122 """
123 channel = self.channel
124 try:
125 #queue not specified and none previously declared for channel:
126 yield channel.basic_consume(queue="")
127 self.fail("Expected failure when consuming from unspecified queue")
128 except ChannelClosed as e:
129 self.assertChannelException(404, e.args[0])
130
115 @inlineCallbacks131 @inlineCallbacks
116 def test_consume_unique_consumers(self):132 def test_consume_unique_consumers(self):
117 """133 """
@@ -126,7 +142,7 @@
126 try:142 try:
127 yield channel.basic_consume(consumer_tag="first", queue="test-queue-3")143 yield channel.basic_consume(consumer_tag="first", queue="test-queue-3")
128 self.fail("Expected consume request to fail due to non-unique tag")144 self.fail("Expected consume request to fail due to non-unique tag")
129 except Closed, e:145 except ConnectionClosed, e:
130 self.assertConnectionException(530, e.args[0])146 self.assertConnectionException(530, e.args[0])
131147
132 @inlineCallbacks148 @inlineCallbacks
133149
=== modified file 'src/txamqp/test/test_broker.py'
--- src/txamqp/test/test_broker.py 2016-06-06 07:09:04 +0000
+++ src/txamqp/test/test_broker.py 2016-11-23 16:38:57 +0000
@@ -16,7 +16,7 @@
16# specific language governing permissions and limitations16# specific language governing permissions and limitations
17# under the License.17# under the License.
18#18#
19from txamqp.client import Closed19from txamqp.client import ConnectionClosed
20from txamqp.queue import Empty20from txamqp.queue import Empty
21from txamqp.content import Content21from txamqp.content import Content
22from txamqp.testlib import TestBase, supportedBrokers, QPID, OPENAMQ22from txamqp.testlib import TestBase, supportedBrokers, QPID, OPENAMQ
@@ -132,7 +132,7 @@
132 try:132 try:
133 yield channel.queue_declare(exclusive=True)133 yield channel.queue_declare(exclusive=True)
134 self.fail("Expected error on queue_declare for invalid channel")134 self.fail("Expected error on queue_declare for invalid channel")
135 except Closed, e:135 except ConnectionClosed as e:
136 self.assertConnectionException(504, e.args[0])136 self.assertConnectionException(504, e.args[0])
137 137
138 @inlineCallbacks138 @inlineCallbacks
@@ -143,7 +143,7 @@
143 try:143 try:
144 yield channel.queue_declare(exclusive=True)144 yield channel.queue_declare(exclusive=True)
145 self.fail("Expected error on queue_declare for closed channel")145 self.fail("Expected error on queue_declare for closed channel")
146 except Closed, e:146 except ConnectionClosed as e:
147 self.assertConnectionException(504, e.args[0])147 self.assertConnectionException(504, e.args[0])
148148
149 @supportedBrokers(QPID, OPENAMQ)149 @supportedBrokers(QPID, OPENAMQ)
150150
=== modified file 'src/txamqp/test/test_exchange.py'
--- src/txamqp/test/test_exchange.py 2011-02-08 12:34:54 +0000
+++ src/txamqp/test/test_exchange.py 2016-11-23 16:38:57 +0000
@@ -24,9 +24,9 @@
24"""24"""
2525
26from txamqp.queue import Empty26from txamqp.queue import Empty
27from txamqp.testlib import TestBase, supportedBrokers, QPID, OPENAMQ27from txamqp.testlib import TestBase, supportedBrokers, QPID, OPENAMQ, RABBITMQ
28from txamqp.content import Content28from txamqp.content import Content
29from txamqp.client import Closed29from txamqp.client import ChannelClosed, ConnectionClosed
3030
31from twisted.internet.defer import inlineCallbacks31from twisted.internet.defer import inlineCallbacks
3232
@@ -238,7 +238,7 @@
238 try:238 try:
239 yield self.channel.exchange_declare(exchange="humpty_dumpty", passive=True)239 yield self.channel.exchange_declare(exchange="humpty_dumpty", passive=True)
240 self.fail("Expected 404 for passive declaration of unknown exchange.")240 self.fail("Expected 404 for passive declaration of unknown exchange.")
241 except Closed, e:241 except ChannelClosed as e:
242 self.assertChannelException(404, e.args[0])242 self.assertChannelException(404, e.args[0])
243243
244244
@@ -334,7 +334,7 @@
334 try:334 try:
335 yield self.channel.exchange_declare(exchange="test_type_not_known_exchange", type="invalid_type")335 yield self.channel.exchange_declare(exchange="test_type_not_known_exchange", type="invalid_type")
336 self.fail("Expected 503 for declaration of unknown exchange type.")336 self.fail("Expected 503 for declaration of unknown exchange type.")
337 except Closed, e:337 except ConnectionClosed as e:
338 self.assertConnectionException(503, e.args[0])338 self.assertConnectionException(503, e.args[0])
339339
340 @supportedBrokers(QPID, OPENAMQ)340 @supportedBrokers(QPID, OPENAMQ)
@@ -344,7 +344,7 @@
344 try:344 try:
345 yield self.channel.exchange_declare(exchange="test_different_declared_type_exchange", type="topic")345 yield self.channel.exchange_declare(exchange="test_different_declared_type_exchange", type="topic")
346 self.fail("Expected 530 for redeclaration of exchange with different type.")346 self.fail("Expected 530 for redeclaration of exchange with different type.")
347 except Closed, e:347 except ConnectionClosed as e:
348 self.assertConnectionException(530, e.args[0])348 self.assertConnectionException(530, e.args[0])
349 #cleanup 349 #cleanup
350 other = yield self.connect()350 other = yield self.connect()
@@ -352,3 +352,24 @@
352 yield c2.channel_open()352 yield c2.channel_open()
353 yield c2.exchange_delete(exchange="test_different_declared_type_exchange")353 yield c2.exchange_delete(exchange="test_different_declared_type_exchange")
354354
355 @supportedBrokers(RABBITMQ)
356 @inlineCallbacks
357 def testDifferentDeclaredTypeRabbit(self):
358 """Test redeclaration of exchange with different type on RabbitMQ."""
359 yield self.channel.exchange_declare(
360 exchange="test_different_declared_type_exchange", type="direct")
361 try:
362 yield self.channel.exchange_declare(
363 exchange="test_different_declared_type_exchange", type="topic")
364 self.fail(
365 "Expected 406 for redeclaration of exchange with "
366 "different type.")
367 except ChannelClosed as e:
368 self.assertChannelException(406, e.args[0])
369 finally:
370 # cleanup
371 other = yield self.connect()
372 c2 = yield other.channel(1)
373 yield c2.channel_open()
374 yield c2.exchange_delete(
375 exchange="test_different_declared_type_exchange")
355376
=== modified file 'src/txamqp/test/test_protocol.py'
--- src/txamqp/test/test_protocol.py 2016-06-06 07:09:04 +0000
+++ src/txamqp/test/test_protocol.py 2016-11-23 16:38:57 +0000
@@ -4,7 +4,8 @@
4from twisted.logger import Logger4from twisted.logger import Logger
55
6from txamqp.protocol import AMQClient6from txamqp.protocol import AMQClient
7from txamqp.client import TwistedDelegate, Closed7from txamqp.client import (
8 TwistedDelegate, Closed, ConnectionClosed, ChannelClosed)
8from txamqp.testing import AMQPump9from txamqp.testing import AMQPump
9from txamqp.spec import DEFAULT_SPEC, load10from txamqp.spec import DEFAULT_SPEC, load
10from txamqp.queue import Closed as QueueClosed11from txamqp.queue import Closed as QueueClosed
@@ -34,6 +35,14 @@
34 channel0 = self.successResultOf(self.protocol.channel(0))35 channel0 = self.successResultOf(self.protocol.channel(0))
35 self.assertTrue(channel0.closed)36 self.assertTrue(channel0.closed)
3637
38 def test_connection_close_raises_error(self):
39 """Test receiving a connection-close method raises ConnectionClosed."""
40 channel = self.successResultOf(self.protocol.channel(0))
41 d = channel.basic_consume(queue="test-queue")
42 self.transport.channel(0).connection_close(reply_code=320)
43 failure = self.failureResultOf(d)
44 self.assertIsInstance(failure.value, ConnectionClosed)
45
37 def test_close(self):46 def test_close(self):
38 """Test explicitely closing a client."""47 """Test explicitely closing a client."""
39 d = self.protocol.close()48 d = self.protocol.close()
@@ -106,6 +115,25 @@
106 self.assertIsInstance(failure.value, Closed)115 self.assertIsInstance(failure.value, Closed)
107 self.assertIsInstance(failure.value.args[0].value, ConnectionLost)116 self.assertIsInstance(failure.value.args[0].value, ConnectionLost)
108117
118 def test_channel_close(self):
119 """Test receiving a channel-close method raises ChannelClosed."""
120 channel = self.successResultOf(self.protocol.channel(0))
121 d = channel.basic_consume(queue="non-existing-queue")
122 self.transport.channel(0).channel_close(reply_code=404)
123 failure = self.failureResultOf(d)
124 self.assertIsInstance(failure.value, ChannelClosed)
125
126 def test_sending_method_on_closed_channel(self):
127 """Sending a method on a closed channel fails immediately."""
128 channel = self.successResultOf(self.protocol.channel(0))
129 self.transport.channel(0).connection_close(reply_code=320)
130 self.transport.outgoing.clear()
131 d = channel.basic_consume(queue="test-queue")
132 # No frames were sent
133 self.assertEqual({}, self.transport.outgoing)
134 failure = self.failureResultOf(d)
135 self.assertIsInstance(failure.value, ConnectionClosed)
136
109 def test_disconnected_event(self):137 def test_disconnected_event(self):
110 """Test disconnected event fired after the connection is lost."""138 """Test disconnected event fired after the connection is lost."""
111 deferred = self.protocol.disconnected.wait()139 deferred = self.protocol.disconnected.wait()
112140
=== modified file 'src/txamqp/test/test_queue.py'
--- src/txamqp/test/test_queue.py 2016-05-23 14:41:22 +0000
+++ src/txamqp/test/test_queue.py 2016-11-23 16:38:57 +0000
@@ -64,7 +64,7 @@
64 #queue specified but doesn't exist:64 #queue specified but doesn't exist:
65 yield channel.queue_purge(queue="invalid-queue")65 yield channel.queue_purge(queue="invalid-queue")
66 self.fail("Expected failure when purging non-existent queue")66 self.fail("Expected failure when purging non-existent queue")
67 except Closed, e:67 except Closed as e:
68 self.assertChannelException(404, e.args[0])68 self.assertChannelException(404, e.args[0])
6969
70 channel = yield self.client.channel(3)70 channel = yield self.client.channel(3)
@@ -73,7 +73,7 @@
73 #queue not specified and none previously declared for channel:73 #queue not specified and none previously declared for channel:
74 yield channel.queue_purge()74 yield channel.queue_purge()
75 self.fail("Expected failure when purging unspecified queue")75 self.fail("Expected failure when purging unspecified queue")
76 except Closed, e:76 except Closed as e:
77 self.assertConnectionException(530, e.args[0])77 self.assertConnectionException(530, e.args[0])
7878
79 #cleanup79 #cleanup
@@ -100,7 +100,7 @@
100 #other connection should not be allowed to declare this:100 #other connection should not be allowed to declare this:
101 yield c2.queue_declare(queue="exclusive-queue", exclusive="True")101 yield c2.queue_declare(queue="exclusive-queue", exclusive="True")
102 self.fail("Expected second exclusive queue_declare to raise a channel exception")102 self.fail("Expected second exclusive queue_declare to raise a channel exception")
103 except Closed, e:103 except Closed as e:
104 self.assertChannelException(405, e.args[0])104 self.assertChannelException(405, e.args[0])
105105
106 @inlineCallbacks106 @inlineCallbacks
@@ -116,7 +116,7 @@
116 #other connection should not be allowed to declare this:116 #other connection should not be allowed to declare this:
117 yield channel.queue_declare(queue="passive-queue-2", passive="True")117 yield channel.queue_declare(queue="passive-queue-2", passive="True")
118 self.fail("Expected passive declaration of non-existant queue to raise a channel exception")118 self.fail("Expected passive declaration of non-existant queue to raise a channel exception")
119 except Closed, e:119 except Closed as e:
120 self.assertChannelException(404, e.args[0])120 self.assertChannelException(404, e.args[0])
121121
122 @inlineCallbacks122 @inlineCallbacks
@@ -140,7 +140,7 @@
140 try:140 try:
141 yield channel.queue_bind(queue="queue-1", exchange="an-invalid-exchange", routing_key="key1")141 yield channel.queue_bind(queue="queue-1", exchange="an-invalid-exchange", routing_key="key1")
142 self.fail("Expected bind to non-existant exchange to fail")142 self.fail("Expected bind to non-existant exchange to fail")
143 except Closed, e:143 except Closed as e:
144 self.assertChannelException(404, e.args[0])144 self.assertChannelException(404, e.args[0])
145145
146 #need to reopen a channel:146 #need to reopen a channel:
@@ -151,7 +151,7 @@
151 try:151 try:
152 yield channel.queue_bind(queue="queue-2", exchange="amq.direct", routing_key="key1")152 yield channel.queue_bind(queue="queue-2", exchange="amq.direct", routing_key="key1")
153 self.fail("Expected bind of non-existant queue to fail")153 self.fail("Expected bind of non-existant queue to fail")
154 except Closed, e:154 except Closed as e:
155 self.assertChannelException(404, e.args[0])155 self.assertChannelException(404, e.args[0])
156156
157 @inlineCallbacks157 @inlineCallbacks
@@ -172,7 +172,7 @@
172 try:172 try:
173 yield channel.queue_declare(queue="delete-me", passive="True")173 yield channel.queue_declare(queue="delete-me", passive="True")
174 self.fail("Queue has not been deleted")174 self.fail("Queue has not been deleted")
175 except Closed, e:175 except Closed as e:
176 self.assertChannelException(404, e.args[0])176 self.assertChannelException(404, e.args[0])
177177
178 @inlineCallbacks178 @inlineCallbacks
@@ -200,7 +200,7 @@
200 result = yield channel.queue_delete(queue="i-dont-exist", if_empty="True")200 result = yield channel.queue_delete(queue="i-dont-exist", if_empty="True")
201 print result201 print result
202 self.fail("Expected delete of non-existant queue to fail")202 self.fail("Expected delete of non-existant queue to fail")
203 except Closed, e:203 except Closed as e:
204 self.assertChannelException(404, e.args[0])204 self.assertChannelException(404, e.args[0])
205205
206 @inlineCallbacks206 @inlineCallbacks
@@ -219,7 +219,7 @@
219 try:219 try:
220 yield channel.queue_delete(queue="delete-me-2", if_empty="True")220 yield channel.queue_delete(queue="delete-me-2", if_empty="True")
221 self.fail("Expected delete if_empty to fail for non-empty queue")221 self.fail("Expected delete if_empty to fail for non-empty queue")
222 except Closed, e:222 except Closed as e:
223 self.assertChannelException(406, e.args[0])223 self.assertChannelException(406, e.args[0])
224224
225 #need new channel now:225 #need new channel now:
@@ -240,7 +240,7 @@
240 try:240 try:
241 yield channel.queue_declare(queue="delete-me-2", passive="True")241 yield channel.queue_declare(queue="delete-me-2", passive="True")
242 self.fail("Queue has not been deleted")242 self.fail("Queue has not been deleted")
243 except Closed, e:243 except Closed as e:
244 self.assertChannelException(404, e.args[0])244 self.assertChannelException(404, e.args[0])
245245
246 @inlineCallbacks246 @inlineCallbacks
@@ -262,7 +262,7 @@
262 try:262 try:
263 yield channel2.queue_delete(queue="delete-me-3", if_unused="True")263 yield channel2.queue_delete(queue="delete-me-3", if_unused="True")
264 self.fail("Expected delete if_unused to fail for queue with existing consumer")264 self.fail("Expected delete if_unused to fail for queue with existing consumer")
265 except Closed, e:265 except Closed as e:
266 self.assertChannelException(406, e.args[0])266 self.assertChannelException(406, e.args[0])
267267
268268
@@ -272,7 +272,7 @@
272 try:272 try:
273 yield channel.queue_declare(queue="delete-me-3", passive="True")273 yield channel.queue_declare(queue="delete-me-3", passive="True")
274 self.fail("Queue has not been deleted")274 self.fail("Queue has not been deleted")
275 except Closed, e:275 except Closed as e:
276 self.assertChannelException(404, e.args[0])276 self.assertChannelException(404, e.args[0])
277277
278278

Subscribers

People subscribed via source and target branches

to status/vote changes: