launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26332
[Merge] ~cjwatson/launchpad:py3-coop-answersbugs-doctests-future-imports into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-coop-answersbugs-doctests-future-imports into launchpad:master.
Commit message:
Convert lp.coop.answersbugs doctests to __future__ imports
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398138
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-coop-answersbugs-doctests-future-imports into launchpad:master.
diff --git a/lib/lp/coop/answersbugs/stories/question-buglink.txt b/lib/lp/coop/answersbugs/stories/question-buglink.txt
index f816dde..ed013b1 100644
--- a/lib/lp/coop/answersbugs/stories/question-buglink.txt
+++ b/lib/lp/coop/answersbugs/stories/question-buglink.txt
@@ -52,8 +52,8 @@ portlet:
>>> user_browser.getControl('Bug ID').value = '1'
>>> user_browser.getControl('Link').click()
- >>> print extract_text(
- ... find_tag_by_id(user_browser.contents, 'related-bugs'))
+ >>> print(extract_text(
+ ... find_tag_by_id(user_browser.contents, 'related-bugs')))
Related bugs
Bug #1: Firefox does not support SVG
@@ -68,7 +68,7 @@ A notification is also displayed.
To remove bug links, the user uses the 'Remove Bug Link' action.
>>> user_browser.getLink('Remove bug link').click()
- >>> print user_browser.title
+ >>> print(user_browser.title)
Remove links to bug reports : Question #...
The list of linked bugs is displayed. The user selects the link to
@@ -85,8 +85,8 @@ message is displayed:
>>> soup = find_main_content(user_browser.contents)
>>> soup.find('div', 'informational message')
<div class="informational message">Removed link to bug #...</div>
- >>> print extract_text(
- ... find_tag_by_id(user_browser.contents, 'related-bugs'))
+ >>> print(extract_text(
+ ... find_tag_by_id(user_browser.contents, 'related-bugs')))
Related bugs
@@ -119,7 +119,7 @@ have access to:
>>> browser.getControl('Bug ID').value = '6'
>>> browser.getControl('Link').click()
>>> for tag in find_tags_by_class(browser.contents, 'message'):
- ... print tag.decode_contents()
+ ... print(tag.decode_contents())
There is 1 error.
You are not allowed to link to private bug #6.
@@ -131,8 +131,8 @@ able to link to that bug.
>>> admin_browser.getLink('Link existing bug').click()
>>> admin_browser.getControl('Bug ID').value = '6'
>>> admin_browser.getControl('Link').click()
- >>> print extract_text(
- ... find_tag_by_id(admin_browser.contents, 'related-bugs'))
+ >>> print(extract_text(
+ ... find_tag_by_id(admin_browser.contents, 'related-bugs')))
Related bugs
Bug #6: Firefox crashes when Save As dialog for a nonexistent window
is closed
@@ -142,8 +142,8 @@ nothing.
>>> anon_browser.open(
... 'http://launchpad.test/firefox/+question/2')
- >>> print extract_text(
- ... find_tag_by_id(anon_browser.contents, 'related-bugs'))
+ >>> print(extract_text(
+ ... find_tag_by_id(anon_browser.contents, 'related-bugs')))
Related bugs
Only the administrator will be able to unlink the bug.
diff --git a/lib/lp/coop/answersbugs/stories/question-makebug.txt b/lib/lp/coop/answersbugs/stories/question-makebug.txt
index a38f456..e47b617 100644
--- a/lib/lp/coop/answersbugs/stories/question-makebug.txt
+++ b/lib/lp/coop/answersbugs/stories/question-makebug.txt
@@ -13,7 +13,7 @@ the question's description and the title is empty.
>>> browser.addHeader('Authorization', 'Basic foo.bar@xxxxxxxxxxxxx:test')
>>> createLink.click()
- >>> print browser.title
+ >>> print(browser.title)
Create bug report based on question #2...
>>> browser.getControl('Summary').value
''
@@ -27,7 +27,7 @@ bug.
>>> browser.getControl('Create').click()
>>> soup = find_main_content(browser.contents)
>>> for tag in soup('div', 'message'):
- ... print tag.string
+ ... print(tag.string)
Required input is missing.
Required input is missing.
@@ -43,9 +43,9 @@ and description and redirects the user to the bug page.
'.../firefox/+bug/...'
>>> soup = find_main_content(browser.contents)
>>> for tag in soup('h1'):
- ... print extract_text(tag)
+ ... print(extract_text(tag))
W3C SVG demo doesn't work in Firefox Edit
- >>> print extract_text(find_tag_by_id(browser.contents, 'edit-description'))
+ >>> print(extract_text(find_tag_by_id(browser.contents, 'edit-description')))
Edit Bug Description
Browsing to the W3C SVG demo results in a blank page.
@@ -54,7 +54,7 @@ questions' portlet:
>>> portlet = find_portlet(browser.contents, 'Related questions')
>>> for question in portlet.findAll('li', 'question-row'):
- ... print question.decode_contents()
+ ... print(question.decode_contents())
<span class="sprite question">Mozilla Firefox</span>: ...<a href=".../firefox/+question/2">Problem...
A user can't create a bug report when a question has already a bug linked
@@ -79,5 +79,5 @@ It works with distribution questions as well.
'.../ubuntu/+bug/...'
>>> soup = find_main_content(browser.contents)
>>> for tag in soup('div', 'informational message'):
- ... print tag.string
+ ... print(tag.string)
Thank you! Bug...created.
diff --git a/lib/lp/coop/answersbugs/tests/test_doc.py b/lib/lp/coop/answersbugs/tests/test_doc.py
index dac74e4..7e2d1d4 100644
--- a/lib/lp/coop/answersbugs/tests/test_doc.py
+++ b/lib/lp/coop/answersbugs/tests/test_doc.py
@@ -29,6 +29,7 @@ from lp.testing.layers import (
LaunchpadZopelessLayer,
)
from lp.testing.mail_helpers import pop_notifications
+from lp.testing.pages import setUpGlobs
from lp.testing.systemdocs import (
LayeredDocFileSuite,
setUp,
@@ -73,7 +74,7 @@ def bugLinkedToQuestionSetUp(test):
def get_bugtask_linked_to_question():
return getUtility(IBugTaskSet).get(bugtask_id)
- setUp(test)
+ setUp(test, future=True)
bugtask_id = _createUbuntuBugTaskLinkedToQuestion()
test.globs['get_bugtask_linked_to_question'] = (
get_bugtask_linked_to_question)
@@ -100,11 +101,10 @@ def uploadQueueBugLinkedToQuestionSetUp(test):
# Files that have special needs can construct their own suite
special = {
- 'notifications-linked-private-bug.txt':
- LayeredDocFileSuite(
- 'notifications-linked-private-bug.txt',
- setUp=bugLinkedToQuestionSetUp, tearDown=tearDown,
- layer=DatabaseFunctionalLayer),
+ 'notifications-linked-private-bug.txt': LayeredDocFileSuite(
+ 'notifications-linked-private-bug.txt',
+ setUp=bugLinkedToQuestionSetUp, tearDown=tearDown,
+ layer=DatabaseFunctionalLayer),
'notifications-linked-bug.txt': LayeredDocFileSuite(
'notifications-linked-bug.txt',
setUp=bugLinkedToQuestionSetUp, tearDown=tearDown,
@@ -125,4 +125,7 @@ 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))