launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24128
[Merge] ~cjwatson/launchpad:no-amqp-auto-delete into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:no-amqp-auto-delete into launchpad:master.
Commit message:
Fix py-amqp deprecation warning
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/375696
py-amqp was issuing the deprecation warning "The auto_delete flag for exchanges has been deprecated and will be removed from py-amqp v1.5.0". Use Fixture.addCleanup to delete the exchange instead.
The auto_delete flag for queues wasn't deprecated, but it seems to make sense to handle it in the same way, since this way the CaptureOops fixture is in control of both lifetimes.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:no-amqp-auto-delete into launchpad:master.
diff --git a/lib/lp/testing/fixture.py b/lib/lp/testing/fixture.py
index 45d3b50..34bfed2 100644
--- a/lib/lp/testing/fixture.py
+++ b/lib/lp/testing/fixture.py
@@ -279,12 +279,15 @@ class CaptureOops(Fixture):
that it will be automatically nuked and must be recreated.
"""
self.queue_name, _, _ = self.channel.queue_declare(
- durable=True, auto_delete=True)
+ durable=True, auto_delete=False)
+ self.addCleanup(self.channel.queue_delete, self.queue_name)
# In production the exchange already exists and is durable, but
# here we make it just-in-time, and tell it to go when the test
# fixture goes.
self.channel.exchange_declare(config.error_reports.error_exchange,
- "fanout", durable=True, auto_delete=True)
+ "fanout", durable=True, auto_delete=False)
+ self.addCleanup(
+ self.channel.exchange_delete, config.error_reports.error_exchange)
self.channel.queue_bind(
self.queue_name, config.error_reports.error_exchange)