Merge lp:~jelmer/launchpad/693757-py2.7-compat into lp:launchpad

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merged at revision: 12156
Proposed branch: lp:~jelmer/launchpad/693757-py2.7-compat
Merge into: lp:launchpad
Diff against target: 97 lines (+22/-15)
1 file modified
lib/lp/archiveuploader/tests/nascentupload-announcements.txt (+22/-15)
To merge this branch: bzr merge lp:~jelmer/launchpad/693757-py2.7-compat
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
j.c.sackett (community) code* Approve
Review via email: mp+44566@code.launchpad.net

Commit message

[r=bac,jcsackett][ui=none][bug=693757] Fix python2.7 compatibility of nascentupload-announcements.txt.

Description of the change

Python 2.7 changed the characters that are used to separate addresses in email fields. This breaks the nascentupload-announcements.txt doc test, which relies on the behaviour of the previous versions of Python.

This patch adds a convenience function for pretty printing the address list, which strips out the separator characters.

== Tests ==

./bin/test -t nascentupload-announcements.txt

To post a comment you must log in.
Revision history for this message
j.c.sackett (jcsackett) wrote :

Jelmer--

This look straightforward and good to land.

The file is really out of date for our standards though (lint sees problems with indentation, headers &c). I won't require changes to pass review, but it would be awesome if you could update the file.

As I'm training, someone else will have to follow this up. I'll go ahead and hunt that down now.

review: Approve (code*)
Revision history for this message
Brad Crittenden (bac) wrote :

Jelmer I agree with Jon that this is a nice branch. Thanks to you both.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/archiveuploader/tests/nascentupload-announcements.txt'
2--- lib/lp/archiveuploader/tests/nascentupload-announcements.txt 2010-12-22 20:46:21 +0000
3+++ lib/lp/archiveuploader/tests/nascentupload-announcements.txt 2010-12-23 12:23:56 +0000
4@@ -39,9 +39,14 @@
5 Helper functions to examine emails that were sent:
6
7 >>> from lp.services.mail import stub
8+ >>> from lp.testing.mail_helpers import pop_notifications
9+
10 >>> def by_to_addrs(a, b):
11 ... return cmp(a[1], b[1])
12- >>> from lp.testing.mail_helpers import pop_notifications
13+
14+ >>> def print_addrlist(field):
15+ ... for entry in field.split(','):
16+ ... print entry.strip()
17
18 Import the test keys to use 'insecure' policy.
19
20@@ -105,8 +110,8 @@
21 >>> notification['Subject']
22 '[ubuntu/hoary] bar 1.0-1 (New)'
23
24- >>> notification['To']
25- 'Daniel Silverstone <daniel.silverstone@canonical.com>'
26+ >>> print_addrlist(notification['To'])
27+ Daniel Silverstone <daniel.silverstone@canonical.com>
28
29 Let's ACCEPT bar sources in order to make the next uploads of this
30 series *known* in hoary:
31@@ -152,8 +157,8 @@
32 >>> notification['X-Katie']
33 'Launchpad actually'
34
35- >>> notification['To']
36- 'Daniel Silverstone <daniel.silverstone@canonical.com>'
37+ >>> print_addrlist(notification['To'])
38+ Daniel Silverstone <daniel.silverstone@canonical.com>
39
40 Upload notifications from primary archive do not contain the
41 'X-Launchpad-PPA' header, since it doesn't apply to this context.
42@@ -277,8 +282,8 @@
43 >>> notification['X-Katie']
44 'Launchpad actually'
45
46- >>> notification['To']
47- 'Foo Bar <foo.bar@canonical.com>'
48+ >>> print_addrlist(notification['To'])
49+ Foo Bar <foo.bar@canonical.com>
50
51 On PPA upload notifications the 'X-Launchpad-PPA' is present and
52 contains the target PPA owner account name.
53@@ -435,8 +440,9 @@
54 >>> notification['X-Katie']
55 'Launchpad actually'
56
57- >>> notification['To']
58- 'Foo Bar <foo.bar@canonical.com>,\n\tDaniel Silverstone <daniel.silverstone@canonical.com>'
59+ >>> print_addrlist(notification['To'])
60+ Foo Bar <foo.bar@canonical.com>
61+ Daniel Silverstone <daniel.silverstone@canonical.com>
62
63 >>> notification['Subject']
64 '[ubuntu/hoary-updates] bar 1.0-2 (Waiting for approval)'
65@@ -464,8 +470,9 @@
66 >>> notification['X-Katie']
67 'Launchpad actually'
68
69- >>> notification['To']
70- 'Foo Bar <foo.bar@canonical.com>,\n\tDaniel Silverstone <daniel.silverstone@canonical.com>'
71+ >>> print_addrlist(notification['To'])
72+ Foo Bar <foo.bar@canonical.com>
73+ Daniel Silverstone <daniel.silverstone@canonical.com>
74
75 >>> notification['Subject']
76 '[ubuntu/hoary-backports] bar 1.0-3 (Waiting for approval)'
77@@ -515,8 +522,8 @@
78 >>> notification['X-Katie']
79 'Launchpad actually'
80
81- >>> notification['To']
82- 'Celso Providelo <celso.providelo@canonical.com>'
83+ >>> print_addrlist(notification['To'])
84+ Celso Providelo <celso.providelo@canonical.com>
85
86 >>> notification['Subject']
87 '[ubuntu/hoary-backports] bar 1.0-4 (Accepted)'
88@@ -814,8 +821,8 @@
89 >>> notification['X-Katie']
90 'Launchpad actually'
91
92- >>> notification['To']
93- 'Daniel Silverstone <daniel.silverstone@canonical.com>'
94+ >>> print_addrlist(notification['To'])
95+ Daniel Silverstone <daniel.silverstone@canonical.com>
96
97 Remove the misnamed changes file copy used for testing.
98