← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Jelmer Vernooij has proposed merging lp:~jelmer/launchpad/693757-py2.7-compat into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #693757 nascentupload-announcements breaks on python2.7
  https://bugs.launchpad.net/bugs/693757

For more details, see:
https://code.launchpad.net/~jelmer/launchpad/693757-py2.7-compat/+merge/44566

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
-- 
https://code.launchpad.net/~jelmer/launchpad/693757-py2.7-compat/+merge/44566
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jelmer/launchpad/693757-py2.7-compat into lp:launchpad.
=== modified file 'lib/lp/archiveuploader/tests/nascentupload-announcements.txt'
--- lib/lp/archiveuploader/tests/nascentupload-announcements.txt	2010-12-22 20:46:21 +0000
+++ lib/lp/archiveuploader/tests/nascentupload-announcements.txt	2010-12-23 12:23:56 +0000
@@ -39,9 +39,14 @@
 Helper functions to examine emails that were sent:
 
   >>> from lp.services.mail import stub
+  >>> from lp.testing.mail_helpers import pop_notifications
+
   >>> def by_to_addrs(a, b):
   ...     return cmp(a[1], b[1])
-  >>> from lp.testing.mail_helpers import pop_notifications
+
+  >>> def print_addrlist(field):
+  ...    for entry in field.split(','):
+  ...        print entry.strip()
 
 Import the test keys to use 'insecure' policy.
 
@@ -105,8 +110,8 @@
   >>> notification['Subject']
   '[ubuntu/hoary] bar 1.0-1 (New)'
 
-  >>> notification['To']
-  'Daniel Silverstone <daniel.silverstone@xxxxxxxxxxxxx>'
+  >>> print_addrlist(notification['To'])
+  Daniel Silverstone <daniel.silverstone@xxxxxxxxxxxxx>
 
 Let's ACCEPT bar sources in order to make the next uploads of this
 series *known* in hoary:
@@ -152,8 +157,8 @@
   >>> notification['X-Katie']
   'Launchpad actually'
 
-  >>> notification['To']
-  'Daniel Silverstone <daniel.silverstone@xxxxxxxxxxxxx>'
+  >>> print_addrlist(notification['To'])
+  Daniel Silverstone <daniel.silverstone@xxxxxxxxxxxxx>
 
 Upload notifications from primary archive do not contain the
 'X-Launchpad-PPA' header, since it doesn't apply to this context.
@@ -277,8 +282,8 @@
   >>> notification['X-Katie']
   'Launchpad actually'
 
-  >>> notification['To']
-  'Foo Bar <foo.bar@xxxxxxxxxxxxx>'
+  >>> print_addrlist(notification['To'])
+  Foo Bar <foo.bar@xxxxxxxxxxxxx>
 
 On PPA upload notifications the 'X-Launchpad-PPA' is present and
 contains the target PPA owner account name.
@@ -435,8 +440,9 @@
   >>> notification['X-Katie']
   'Launchpad actually'
 
-  >>> notification['To']
-  'Foo Bar <foo.bar@xxxxxxxxxxxxx>,\n\tDaniel Silverstone <daniel.silverstone@xxxxxxxxxxxxx>'
+  >>> print_addrlist(notification['To'])
+  Foo Bar <foo.bar@xxxxxxxxxxxxx>
+  Daniel Silverstone <daniel.silverstone@xxxxxxxxxxxxx>
 
   >>> notification['Subject']
   '[ubuntu/hoary-updates] bar 1.0-2 (Waiting for approval)'
@@ -464,8 +470,9 @@
   >>> notification['X-Katie']
   'Launchpad actually'
 
-  >>> notification['To']
-  'Foo Bar <foo.bar@xxxxxxxxxxxxx>,\n\tDaniel Silverstone <daniel.silverstone@xxxxxxxxxxxxx>'
+  >>> print_addrlist(notification['To'])
+  Foo Bar <foo.bar@xxxxxxxxxxxxx>
+  Daniel Silverstone <daniel.silverstone@xxxxxxxxxxxxx>
 
   >>> notification['Subject']
   '[ubuntu/hoary-backports] bar 1.0-3 (Waiting for approval)'
@@ -515,8 +522,8 @@
   >>> notification['X-Katie']
   'Launchpad actually'
 
-  >>> notification['To']
-  'Celso Providelo <celso.providelo@xxxxxxxxxxxxx>'
+  >>> print_addrlist(notification['To'])
+  Celso Providelo <celso.providelo@xxxxxxxxxxxxx>
 
   >>> notification['Subject']
   '[ubuntu/hoary-backports] bar 1.0-4 (Accepted)'
@@ -814,8 +821,8 @@
   >>> notification['X-Katie']
   'Launchpad actually'
 
-  >>> notification['To']
-  'Daniel Silverstone <daniel.silverstone@xxxxxxxxxxxxx>'
+  >>> print_addrlist(notification['To'])
+  Daniel Silverstone <daniel.silverstone@xxxxxxxxxxxxx>
 
 Remove the misnamed changes file copy used for testing.