Merge ~cjwatson/launchpad:no-amqp-auto-delete into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: c4af9b188be317a5917d314e5ef5272a7c557cbe
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:no-amqp-auto-delete
Merge into: launchpad:master
Diff against target: 21 lines (+5/-2)
1 file modified
lib/lp/testing/fixture.py (+5/-2)
Reviewer Review Type Date Requested Status
Ioana Lasc (community) Approve
Review via email: mp+375696@code.launchpad.net

Commit message

Fix py-amqp deprecation warning

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/testing/fixture.py b/lib/lp/testing/fixture.py
2index 45d3b50..34bfed2 100644
3--- a/lib/lp/testing/fixture.py
4+++ b/lib/lp/testing/fixture.py
5@@ -279,12 +279,15 @@ class CaptureOops(Fixture):
6 that it will be automatically nuked and must be recreated.
7 """
8 self.queue_name, _, _ = self.channel.queue_declare(
9- durable=True, auto_delete=True)
10+ durable=True, auto_delete=False)
11+ self.addCleanup(self.channel.queue_delete, self.queue_name)
12 # In production the exchange already exists and is durable, but
13 # here we make it just-in-time, and tell it to go when the test
14 # fixture goes.
15 self.channel.exchange_declare(config.error_reports.error_exchange,
16- "fanout", durable=True, auto_delete=True)
17+ "fanout", durable=True, auto_delete=False)
18+ self.addCleanup(
19+ self.channel.exchange_delete, config.error_reports.error_exchange)
20 self.channel.queue_bind(
21 self.queue_name, config.error_reports.error_exchange)
22

Subscribers

People subscribed via source and target branches

to status/vote changes: