← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:code-vocabularies-doctests-future-imports into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:code-vocabularies-doctests-future-imports into launchpad:master.

Commit message:
Convert lp.code.vocabularies doctests to preferred __future__ imports

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/387031
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:code-vocabularies-doctests-future-imports into launchpad:master.
diff --git a/lib/lp/code/vocabularies/tests/branch.txt b/lib/lp/code/vocabularies/tests/branch.txt
index f3562d5..e22f3ea 100644
--- a/lib/lp/code/vocabularies/tests/branch.txt
+++ b/lib/lp/code/vocabularies/tests/branch.txt
@@ -22,7 +22,7 @@ concerned).
     >>> def print_vocab_branches(vocab, search):
     ...     terms = vocab.searchForTerms(search)
     ...     for name in sorted(term.value.unique_name for term in terms):
-    ...         print name
+    ...         print(name)
 
     >>> print_vocab_branches(branch_vocabulary, 'main')
     ~justdave/+junk/main
@@ -42,11 +42,11 @@ branch unique name as an ID:
 
     >>> from lp.code.interfaces.branchlookup import IBranchLookup
     >>> branch = getUtility(IBranchLookup).get(15)
-    >>> print branch.unique_name
+    >>> print(branch.unique_name)
     ~name12/gnome-terminal/main
     >>> from zope.security.proxy import removeSecurityProxy
     >>> term = removeSecurityProxy(branch_vocabulary).toTerm(branch)
-    >>> print term.token
+    >>> print(term.token)
     ~name12/gnome-terminal/main
 
 The BranchVocabulary recognises both unique names and URLs as tokens:
diff --git a/lib/lp/code/vocabularies/tests/test_doc.py b/lib/lp/code/vocabularies/tests/test_doc.py
index e136049..7191eb0 100644
--- a/lib/lp/code/vocabularies/tests/test_doc.py
+++ b/lib/lp/code/vocabularies/tests/test_doc.py
@@ -8,10 +8,12 @@ Run the doctests.
 import os
 
 from lp.services.testing import build_doctest_suite
+from lp.testing.systemdocs import setUp
 
 
 here = os.path.dirname(os.path.realpath(__file__))
 
 
 def test_suite():
-    return build_doctest_suite(here, '')
+    return build_doctest_suite(
+        here, '', setUp=lambda test: setUp(test, future=True))