Merge lp://staging/~esteve/txamqp/396679-report-trial-connection-error into lp://staging/txamqp

Proposed by Esteve Fernandez
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~esteve/txamqp/396679-report-trial-connection-error
Merge into: lp://staging/txamqp
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~esteve/txamqp/396679-report-trial-connection-error
Reviewer Review Type Date Requested Status
Thomas Herve Approve
Dan Di Spaltro code Approve
Zooko Wilcox-O'Hearn (community) Approve
Esteve Fernandez Approve
Terry Jones Pending
Review via email: mp+8496@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Esteve Fernandez (esteve) :
review: Approve
24. By Esteve Fernandez

fix error output

Revision history for this message
Zooko Wilcox-O'Hearn (zooko) wrote :

Looks good.

review: Approve
Revision history for this message
Dan Di Spaltro (dan-dispaltro) wrote :

+1, this should help out new comers to AMQP and twisted...

review: Approve (code)
Revision history for this message
Esteve Fernandez (esteve) wrote :

Thomas? Terry? What do you think?

Revision history for this message
Thomas Herve (therve) wrote :

It looks ok, just 2 pyflakes to fix:

src/txamqp/testlib.py:23: 'log' imported but unused
src/txamqp/testlib.py:82: undefined name 'broker'

review: Approve
25. By Esteve Fernandez

fixed undefined variable (broker)

Revision history for this message
Terry Jones (terrycojones) wrote :

>>>>> "Esteve" == Esteve Fernandez <email address hidden> writes:
Esteve> Thomas? Terry? What do you think?

I pushed some small changes to

  lp:~terrycojones/txamqp/396679-report-trial-connection-error

There were 4 unused imports, I fixed the broker -> self.broker issue,
added a var to hold the names of all brokers, and removed a duplicate
method (consume).

Terry

Revision history for this message
Esteve Fernandez (esteve) wrote :

> There were 4 unused imports, I fixed the broker -> self.broker issue,
> added a var to hold the names of all brokers, and removed a duplicate
> method (consume).

I'll merge lp:~esteve/txamqp/396679-report-trial-connection-error and file a separate report for those issues (unused imports, duplicate methods, etc.)

Thank you all for your reviews.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/txamqp/testlib.py'
--- src/txamqp/testlib.py 2009-06-17 16:01:31 +0000
+++ src/txamqp/testlib.py 2009-07-09 20:55:26 +0000
@@ -25,7 +25,7 @@
2525
26from txamqp.protocol import AMQChannel, AMQClient, TwistedDelegate26from txamqp.protocol import AMQChannel, AMQClient, TwistedDelegate
2727
28from twisted.internet import protocol, reactor28from twisted.internet import error, protocol, reactor
29from twisted.trial import unittest29from twisted.trial import unittest
30from twisted.internet.defer import inlineCallbacks, Deferred, returnValue, DeferredQueue, DeferredLock30from twisted.internet.defer import inlineCallbacks, Deferred, returnValue, DeferredQueue, DeferredLock
31from twisted.python import failure31from twisted.python import failure
@@ -52,6 +52,9 @@
52 return os.environ.get("TXAMQP_BROKER")52 return os.environ.get("TXAMQP_BROKER")
5353
5454
55USERNAME='guest'
56PASSWORD='guest'
57VHOST='localhost'
55class TestBase(unittest.TestCase):58class TestBase(unittest.TestCase):
5659
57 def __init__(self, *args, **kwargs):60 def __init__(self, *args, **kwargs):
@@ -75,9 +78,9 @@
75 raise RuntimeError(78 raise RuntimeError(
76 "Unsupported broker '%s'. Use one of RABBITMQ, OPENAMQ or "79 "Unsupported broker '%s'. Use one of RABBITMQ, OPENAMQ or "
77 "QPID" % broker)80 "QPID" % broker)
78 self.user = 'guest'81 self.user = USERNAME
79 self.password = 'guest'82 self.password = PASSWORD
80 self.vhost = 'localhost'83 self.vhost = VHOST
81 self.queues = []84 self.queues = []
82 self.exchanges = []85 self.exchanges = []
83 self.connectors = []86 self.connectors = []
@@ -95,6 +98,13 @@
95 onConn = Deferred()98 onConn = Deferred()
96 f = protocol._InstanceFactory(reactor, AMQClient(delegate, vhost, txamqp.spec.load(spec)), onConn)99 f = protocol._InstanceFactory(reactor, AMQClient(delegate, vhost, txamqp.spec.load(spec)), onConn)
97 c = reactor.connectTCP(host, port, f)100 c = reactor.connectTCP(host, port, f)
101 def errb(thefailure):
102 thefailure.trap(error.ConnectionRefusedError)
103 print "failed to connect to host: %s, port: %s; These tests are designed to run against a running instance" \
104 " of the %s AMQP broker on the given host and port. failure: %s" % (_get_broker(), host, port, thefailure,)
105 thefailure.raiseException()
106 onConn.addErrback(errb)
107
98 self.connectors.append(c)108 self.connectors.append(c)
99 client = yield onConn109 client = yield onConn
100110
@@ -103,7 +113,14 @@
103 113
104 @inlineCallbacks114 @inlineCallbacks
105 def setUp(self):115 def setUp(self):
106 self.client = yield self.connect()116 try:
117 self.client = yield self.connect()
118 except txamqp.client.Closed, le:
119 le.args = tuple(("Unable to connect to AMQP broker in order to run tests (perhaps due to auth failure?). " \
120 "The tests assume that an instance of the %s AMQP broker is already set up and that this test script " \
121 "can connect to it and use it as user '%s', password '%s', vhost '%s'." % (_get_broker(),
122 USERNAME, PASSWORD, VHOST),) + le.args)
123 raise
107124
108 self.channel = yield self.client.channel(1)125 self.channel = yield self.client.channel(1)
109 yield self.channel.channel_open()126 yield self.channel.channel_open()

Subscribers

People subscribed via source and target branches

to status/vote changes: