launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26106
[Merge] ~cjwatson/launchpad:py3-services-feeds-future-imports into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-services-feeds-future-imports into launchpad:master.
Commit message:
Convert lp.services.feeds to preferred __future__ imports
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/396914
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-services-feeds-future-imports into launchpad:master.
diff --git a/lib/lp/services/feeds/doc/feeds.txt b/lib/lp/services/feeds/doc/feeds.txt
index f315bb3..8b0b32d 100644
--- a/lib/lp/services/feeds/doc/feeds.txt
+++ b/lib/lp/services/feeds/doc/feeds.txt
@@ -98,7 +98,7 @@ found, indicated by the absence of a ComponentLookupError.
True
>>> for name in ['thing-feed.atom', 'thing-feed.html']:
... feed_view = getMultiAdapter((thing, request), name=name)
- ... print feed_view()
+ ... print(feed_view())
a feed view on an IThing
a feed view on an IThing
diff --git a/lib/lp/services/feeds/stories/xx-links.txt b/lib/lp/services/feeds/stories/xx-links.txt
index 6f0b0ba..54f928a 100644
--- a/lib/lp/services/feeds/stories/xx-links.txt
+++ b/lib/lp/services/feeds/stories/xx-links.txt
@@ -55,7 +55,7 @@ But if the bug is private, there should be no link.
# First check that the bug exists.
>>> auth_browser.open('http://launchpad.test/bugs/14')
- >>> print auth_browser.url
+ >>> print(auth_browser.url)
http://bugs.launchpad.test/jokosher/+bug/14
>>> soup = BeautifulSoup(auth_browser.contents)
@@ -66,7 +66,7 @@ Even so, if they somehow manage to hack the url or use inline ajax editing of
the bug status and attempt to subscribe, they are redirected to the bug page:
>>> auth_browser.open('http://feeds.launchpad.test/bugs/14/bug.atom')
- >>> print auth_browser.url
+ >>> print(auth_browser.url)
http://bugs.launchpad.test/
>>> print_feedback_messages(auth_browser.contents)
The requested bug is private. Feeds do not serve private bugs.
@@ -375,7 +375,7 @@ Even so, if they somehow manage to hack the url, they are redirected to a page
with an error notification:
>>> browser.open('http://feeds.launchpad.test/~name12/landscape/feature-x/branch.atom')
- >>> print browser.url
+ >>> print(browser.url)
http://code.launchpad.test/
>>> print_feedback_messages(browser.contents)
The requested branch is private. Feeds do not serve private branches.
diff --git a/lib/lp/services/feeds/stories/xx-navigation.txt b/lib/lp/services/feeds/stories/xx-navigation.txt
index 5ed27dd..a7cc583 100644
--- a/lib/lp/services/feeds/stories/xx-navigation.txt
+++ b/lib/lp/services/feeds/stories/xx-navigation.txt
@@ -48,7 +48,7 @@ redirects to remote sites, but http() can be used instead.
... GET / HTTP/1.0
... Host: feeds.launchpad.test
... """)
- >>> print response.getOutput()
+ >>> print(response.getOutput())
HTTP/1.0 301 Moved Permanently
...
Location: https://help.launchpad.net/Feeds
@@ -90,7 +90,7 @@ on feeds.launchpad.test and does not work on all the other vhosts.
... try:
... browser.open(url)
... except:
- ... print "Error accessing:", url
+ ... print("Error accessing:", url)
... raise
... prefixes = ('', 'answers.', 'blueprints.', 'bugs.',
... 'code.', 'translations.')
@@ -101,7 +101,7 @@ on feeds.launchpad.test and does not work on all the other vhosts.
... except NotFound:
... pass
... except:
- ... print "Error accessing:", url
+ ... print("Error accessing:", url)
... raise
... else:
... raise AssertionError("Page should not exist: %s" % url)
@@ -139,5 +139,5 @@ Revert configuration change after tests are finished.
feeds.launchpad.test has a favicon.
>>> browser.open('http://feeds.launchpad.test/favicon.ico')
- >>> print browser.headers['Content-Type']
+ >>> print(browser.headers['Content-Type'])
image/png
diff --git a/lib/lp/services/feeds/stories/xx-security.txt b/lib/lp/services/feeds/stories/xx-security.txt
index e19cb85..5977753 100644
--- a/lib/lp/services/feeds/stories/xx-security.txt
+++ b/lib/lp/services/feeds/stories/xx-security.txt
@@ -51,21 +51,21 @@ these HTML feeds, since all the bugs are private.
>>> len(BeautifulSoup(browser.contents, 'xml')('tr'))
1
- >>> print extract_text(BeautifulSoup(browser.contents, 'xml')('tr')[0])
+ >>> print(extract_text(BeautifulSoup(browser.contents, 'xml')('tr')[0]))
Bugs in Jokosher
>>> browser.open('http://feeds.launchpad.test/mozilla/latest-bugs.html')
>>> len(BeautifulSoup(browser.contents, 'xml')('tr'))
1
- >>> print extract_text(BeautifulSoup(browser.contents, 'xml')('tr')[0])
+ >>> print(extract_text(BeautifulSoup(browser.contents, 'xml')('tr')[0]))
Bugs in The Mozilla Project
>>> browser.open('http://feeds.launchpad.test/~name16/latest-bugs.html')
>>> len(BeautifulSoup(browser.contents, 'xml')('tr'))
1
- >>> print extract_text(BeautifulSoup(browser.contents, 'xml')('tr')[0])
+ >>> print(extract_text(BeautifulSoup(browser.contents, 'xml')('tr')[0]))
Bugs for Foo Bar
>>> browser.open(
@@ -73,7 +73,7 @@ these HTML feeds, since all the bugs are private.
>>> len(BeautifulSoup(browser.contents, 'xml')('tr'))
1
- >>> print extract_text(BeautifulSoup(browser.contents, 'xml')('tr')[0])
+ >>> print(extract_text(BeautifulSoup(browser.contents, 'xml')('tr')[0]))
Bugs for Simple Team
>>> browser.open('http://feeds.launchpad.test/bugs/+bugs.html?'
@@ -85,7 +85,7 @@ these HTML feeds, since all the bugs are private.
>>> try:
... browser.open('http://feeds.launchpad.test/bugs/1/bug.html')
... except Unauthorized:
- ... print "Shouldn't raise Unauthorized exception"
+ ... print("Shouldn't raise Unauthorized exception")
>>> BeautifulSoup(browser.contents, 'xml')('entry')
[]
diff --git a/lib/lp/services/feeds/tests/helper.py b/lib/lp/services/feeds/tests/helper.py
index ffa84a4..69221e7 100644
--- a/lib/lp/services/feeds/tests/helper.py
+++ b/lib/lp/services/feeds/tests/helper.py
@@ -3,6 +3,8 @@
"""Helper functions for testing feeds."""
+from __future__ import absolute_import, print_function
+
__metaclass__ = type
__all__ = [
'IThing',
diff --git a/lib/lp/services/feeds/tests/test_doc.py b/lib/lp/services/feeds/tests/test_doc.py
index b0414e4..bb6e9b8 100644
--- a/lib/lp/services/feeds/tests/test_doc.py
+++ b/lib/lp/services/feeds/tests/test_doc.py
@@ -8,6 +8,8 @@ Run the doctests and pagetests.
import os
from lp.services.testing import build_test_suite
+from lp.testing.pages import setUpGlobs
+from lp.testing.systemdocs import setUp
here = os.path.dirname(os.path.realpath(__file__))
@@ -16,4 +18,6 @@ special = {}
def test_suite():
- return build_test_suite(here, special)
+ return build_test_suite(
+ here, special, setUp=lambda test: setUp(test, future=True),
+ pageTestsSetUp=lambda test: setUpGlobs(test, future=True))