← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-registry-future-imports-prepare into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-registry-future-imports-prepare into launchpad:master.

Commit message:
Prepare for __future__ imports in lp.registry doctests

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398086

These are various non-mechanical fixes in preparation for converting the doctests under lp.registry to Launchpad's preferred __future__ imports, avoiding problems with unicode_literals.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-registry-future-imports-prepare into launchpad:master.
diff --git a/lib/lp/registry/doc/cache-country-mirrors.txt b/lib/lp/registry/doc/cache-country-mirrors.txt
index af85dd9..5fd300a 100644
--- a/lib/lp/registry/doc/cache-country-mirrors.txt
+++ b/lib/lp/registry/doc/cache-country-mirrors.txt
@@ -43,10 +43,11 @@ look good.
     >>> fr_txt_path = os.path.join(directory, 'FR.txt')
     >>> print '%o' % stat.S_IMODE(os.stat(fr_txt_path).st_mode)
     644
-    >>> sorted(open(fr_txt_path).read().split('\n'))
-     ['http://archive.ubuntu.com/ubuntu/',
-     'http://localhost:11375/archive-mirror/',
-     'http://localhost:11375/valid-mirror/']
+    >>> for line in sorted(open(fr_txt_path).read().split('\n')):
+    ...     print(line)
+    http://archive.ubuntu.com/ubuntu/
+    http://localhost:11375/archive-mirror/
+    http://localhost:11375/valid-mirror/
 
 Cleanup!
 
diff --git a/lib/lp/registry/doc/distribution.txt b/lib/lp/registry/doc/distribution.txt
index 22ed60f..0c6b903 100644
--- a/lib/lp/registry/doc/distribution.txt
+++ b/lib/lp/registry/doc/distribution.txt
@@ -307,7 +307,7 @@ If we ask for a totally unknown distroseries, we raise NotFoundError
     ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
     Traceback (most recent call last):
     ...
-    lp.app.errors.NotFoundError: 'unknown'
+    lp.app.errors.NotFoundError: ...'unknown'
 
 If we ask for a plain distroseries, it should come back with the RELEASE
 pocket as the pocket.
@@ -338,7 +338,7 @@ raise NotFoundError for us
     ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
     Traceback (most recent call last):
     ...
-    lp.app.errors.NotFoundError: 'hoary-bullshit'
+    lp.app.errors.NotFoundError: ...'hoary-bullshit'
 
 
 Upload related stuff
diff --git a/lib/lp/registry/doc/person-merge.txt b/lib/lp/registry/doc/person-merge.txt
index 40b7030..ebe2ced 100644
--- a/lib/lp/registry/doc/person-merge.txt
+++ b/lib/lp/registry/doc/person-merge.txt
@@ -305,7 +305,7 @@ First, we will test a merge where there is no decoration.
 "Skip" should have been updated with the table and unique reference
 column name.
 
-    >>> print skip
+    >>> print(pretty(skip))
     [('personlocation', 'person')]
 
 There should still be no columns that reference the winner or loser.
diff --git a/lib/lp/registry/doc/person.txt b/lib/lp/registry/doc/person.txt
index 8c772ec..7147f77 100644
--- a/lib/lp/registry/doc/person.txt
+++ b/lib/lp/registry/doc/person.txt
@@ -300,8 +300,8 @@ If we manually change the cache, the adapter will be fooled and will
 return the wrong object.
 
     >>> cache[removeSecurityProxy(person.account)] = 'foo'
-    >>> IPerson(person.account)
-    'foo'
+    >>> print(IPerson(person.account))
+    foo
 
 If the cached value is None, though, the adapter will look up the
 correct Person again and update the cache.
diff --git a/lib/lp/registry/doc/pillar.txt b/lib/lp/registry/doc/pillar.txt
index 8beb155..f92a318 100644
--- a/lib/lp/registry/doc/pillar.txt
+++ b/lib/lp/registry/doc/pillar.txt
@@ -38,7 +38,7 @@ share their name namespace are Product, ProjectGroup and Distribution.
     ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
     Traceback (most recent call last):
     ...
-    lp.app.errors.NotFoundError: 'fnord'
+    lp.app.errors.NotFoundError: ...'fnord'
 
 Inactive projects/project groups are not available through PillarNameSet
 unless we use the special getByName() method which returns active/inactive
@@ -56,7 +56,7 @@ pillars.
     ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
     Traceback (most recent call last):
     ...
-    lp.app.errors.NotFoundError: 'gimp'
+    lp.app.errors.NotFoundError: ...'gimp'
     >>> IProjectGroup.providedBy(pillar_set.getByName('gimp'))
     True
 
diff --git a/lib/lp/registry/doc/productrelease-file-download.txt b/lib/lp/registry/doc/productrelease-file-download.txt
index b8939cf..0c83563 100644
--- a/lib/lp/registry/doc/productrelease-file-download.txt
+++ b/lib/lp/registry/doc/productrelease-file-download.txt
@@ -93,7 +93,7 @@ Attempting to retrieve an alias that does not exist is an error.
     ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
     Traceback (most recent call last):
     ...
-    lp.app.errors.NotFoundError: 'bar.txt'
+    lp.app.errors.NotFoundError: ...'bar.txt'
 
 The ProductReleaseFile can also be retrieved by name.
 
@@ -108,7 +108,7 @@ error.
     ... # doctest: +IGNORE_EXCEPTION_MODULE_IN_PYTHON2
     Traceback (most recent call last):
     ...
-    lp.app.errors.NotFoundError: 'bar.txt'
+    lp.app.errors.NotFoundError: ...'bar.txt'
 
 Deleting the release file results in the file count being reduced.
 Only the product owner, product series owner, admins, or experts can
diff --git a/lib/lp/registry/doc/sourcepackage.txt b/lib/lp/registry/doc/sourcepackage.txt
index 7c23e6d..9c3af77 100644
--- a/lib/lp/registry/doc/sourcepackage.txt
+++ b/lib/lp/registry/doc/sourcepackage.txt
@@ -346,11 +346,11 @@ And they can be used as dictionary keys also:
     >>> a_map = {}
     >>> a_map[hoary_firefox_one] = 'hoary'
     >>> a_map[warty_firefox] = 'warty'
-    >>> a_map[hoary_firefox_two]
-    'hoary'
+    >>> print(a_map[hoary_firefox_two])
+    hoary
 
-    >>> a_map[warty_firefox]
-    'warty'
+    >>> print(a_map[warty_firefox])
+    warty
 
 
 Direct Packagings