183 - def __init__(self, config, channel, queue_name):
184 + def __init__(self, config, connection_factory, queue_name):
185 """Create a Receiver.
186
187 :param config: An oops.Config to republish the OOPS reports.
188 - :param channel: An amqplib Channel to listen for reports on.
189 + :param connection: An amqplib connection factory, used to make the
190 + initial connection and to reconnect if that connection is
191 + interrupted.
docstring says the param is "connection", but it's actually "connection_factory".
227 + while not self.stopping and time.time() < self.connection_start + 120:
This is going to stop retrying immediately if the connection dies after more than two minutes.
183 - def __init__(self, config, channel, queue_name):
184 + def __init__(self, config, connection_factory, queue_name):
185 """Create a Receiver.
186
187 :param config: An oops.Config to republish the OOPS reports.
188 - :param channel: An amqplib Channel to listen for reports on.
189 + :param connection: An amqplib connection factory, used to make the
190 + initial connection and to reconnect if that connection is
191 + interrupted.
docstring says the param is "connection", but it's actually "connection_ factory" .
227 + while not self.stopping and time.time() < self.connection _start + 120:
This is going to stop retrying immediately if the connection dies after more than two minutes.
321 + connection = self.connection _factory( ) (connection. close) channel( ) (channel. close) (QueueFixture( channel, self.getUniqueS tring))
322 + self.addCleanup
323 + channel = connection.
324 + self.addCleanup
325 + queue = self.useFixture
This is now roughly quadruplicated. Put it in a helper or setUp?
318 + def test_publish_ inherit_ id(self) :
Are test_publish and test_publish_ inherit_ id around the wrong way?
304 + # Publication returns the oops ID allocated.
s/allocated/ provided/ ?
371 - def test_receive_ one(self) :
Where'd that go?
398 + connection = self.connection _factory( ) (connection. close) channel( ) (channel. close) (QueueFixture( channel, self.getUniqueS tring))
399 + self.addCleanup
400 + channel = connection.
401 + self.addCleanup
402 + queue = self.useFixture
More duplication.
410 + receiver.sentinel = sentinel run_forever( ) l([expected_ report] , reports)
411 + receiver.
412 + self.assertEqua
May be worth a comment around run_forever to say that it will return quickly since you've already sent the sentinel.
422 + connection = self.connection _factory( ) (connection. close) channel( ) (channel. close) (QueueFixture( channel, self.getUniqueS tring))
423 + self.addCleanup
424 + channel = connection.
425 + self.addCleanup
426 + queue = self.useFixture
Guess what...
499 + # publisher tests is what le aks through when rabbit is shutdown).
You've leaked some whitespace there.
507 + connection = self.connection _factory( ) (connection. close) channel( ) (channel. close) (QueueFixture( channel, self.getUniqueS tring))
508 + self.addCleanup
509 + channel = connection.
510 + self.addCleanup
511 + queue = self.useFixture
Ahem.