launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28413
[Merge] ~cjwatson/launchpad:unsixify-zope-testbrowser into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:unsixify-zope-testbrowser into launchpad:master.
Commit message:
Remove six.ensure_text calls relating to zope.testbrowser
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/421197
The `zope.testbrowser.Browser.{contents,title}` properties return native strings. On Python 2 we sometimes had to explicitly convert those to Unicode, but that's no longer needed on Python 3.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:unsixify-zope-testbrowser into launchpad:master.
diff --git a/lib/lp/answers/stories/question-add-in-other-languages.txt b/lib/lp/answers/stories/question-add-in-other-languages.txt
index ecd376a..3f5a2e0 100644
--- a/lib/lp/answers/stories/question-add-in-other-languages.txt
+++ b/lib/lp/answers/stories/question-add-in-other-languages.txt
@@ -162,6 +162,6 @@ new question.
>>> browser.getControl('Post Question').click()
>>> browser.url
'.../ubuntu/+question/...'
- >>> print(six.ensure_text(browser.title))
+ >>> print(browser.title)
Question #... : Questions : Ubuntu
>>> portlet = find_tag_by_id(browser.contents, 'portlet-details')
diff --git a/lib/lp/answers/stories/question-message.txt b/lib/lp/answers/stories/question-message.txt
index 50e9a8c..e554384 100644
--- a/lib/lp/answers/stories/question-message.txt
+++ b/lib/lp/answers/stories/question-message.txt
@@ -12,7 +12,7 @@ an email post to examine the markup rules. This message contains a
quoted passage, and a signature with an email address in it.
>>> user_browser.open('http://answers.launchpad.test/ubuntu/+question/11')
- >>> print(six.ensure_text(user_browser.title))
+ >>> print(user_browser.title)
Question #11 : ...
>>> user_browser.getControl('Message').value = (
@@ -38,7 +38,7 @@ Email addresses are only shown to authenticated users
Email addresses are visible to authenticated users. Sample Person is
authenticated already, so they will see 'human@xxxxxxxxxxxxx'.
- >>> print(six.ensure_text(user_browser.title))
+ >>> print(user_browser.title)
Question #11 : ...
>>> text = find_tags_by_class(
... user_browser.contents, 'boardCommentBody')[-1]
diff --git a/lib/lp/blueprints/stories/blueprints/xx-superseding.txt b/lib/lp/blueprints/stories/blueprints/xx-superseding.txt
index fe83bdd..45b16f8 100644
--- a/lib/lp/blueprints/stories/blueprints/xx-superseding.txt
+++ b/lib/lp/blueprints/stories/blueprints/xx-superseding.txt
@@ -12,7 +12,7 @@ not already superseded).
>>> browser.open(
... 'http://blueprints.launchpad.test/firefox/+spec/'
... + 'extension-manager-upgrades')
- >>> 'New' in six.ensure_text(browser.contents)
+ >>> 'New' in browser.contents
True
Make sure Bug 4116 stays fixed
@@ -39,10 +39,9 @@ Next, we will POST to that form, setting the spec which supersedes this one:
Now, on the spec page we should see an alert that the spec has been
superseded. The spec status should also have changed to superseded.
- >>> 'This blueprint has been superseded.' in (
- ... six.ensure_text(browser.contents))
+ >>> 'This blueprint has been superseded.' in browser.contents
True
- >>> 'Superseded' in six.ensure_text(browser.contents)
+ >>> 'Superseded' in browser.contents
True
And finally, we want to clear the superseding spec data and reset the
@@ -57,5 +56,5 @@ then it should automatically do this:
Let's confirm the status change:
- >>> 'New' in six.ensure_text(browser.contents)
+ >>> 'New' in browser.contents
True
diff --git a/lib/lp/bugs/browser/tests/test_bugtask.py b/lib/lp/bugs/browser/tests/test_bugtask.py
index 4394120..181da6a 100644
--- a/lib/lp/bugs/browser/tests/test_bugtask.py
+++ b/lib/lp/bugs/browser/tests/test_bugtask.py
@@ -11,7 +11,6 @@ from urllib.parse import urlencode
from lazr.restful.interfaces import IJSONRequestCache
from pytz import UTC
import simplejson
-import six
import soupmatchers
from testscenarios import (
load_tests_apply_scenarios,
@@ -314,7 +313,7 @@ class TestBugTaskView(TestCaseWithFactory):
browser = self.getUserBrowser(canonical_url(bug), bug.owner)
self.assertIn(
'href="/foobar/+bugs?field.tag=depends-on%2B987"',
- six.ensure_text(browser.contents))
+ browser.contents)
def test_information_type(self):
owner = self.factory.makePerson()
@@ -334,7 +333,7 @@ class TestBugTaskView(TestCaseWithFactory):
bug.markAsDuplicate(inactive_bug)
removeSecurityProxy(inactive_project).active = False
browser = self.getUserBrowser(canonical_url(bug))
- contents = six.ensure_text(browser.contents)
+ contents = browser.contents
self.assertIn(
"This bug report is a duplicate of a bug on an inactive project.",
contents)
@@ -349,8 +348,7 @@ class TestBugTaskView(TestCaseWithFactory):
# portlet is hidden.
bug = self.factory.makeBug()
browser = self.getUserBrowser(canonical_url(bug))
- contents = six.ensure_text(browser.contents)
- self.assertNotIn('Related blueprints', contents)
+ self.assertNotIn('Related blueprints', browser.contents)
def test_related_blueprints_is_shown(self):
# When a bug has specifications linked, the Related blueprints portlet
@@ -360,7 +358,7 @@ class TestBugTaskView(TestCaseWithFactory):
with person_logged_in(spec.owner):
spec.linkBug(bug)
browser = self.getUserBrowser(canonical_url(bug))
- contents = six.ensure_text(browser.contents)
+ contents = browser.contents
self.assertIn('Related blueprints', contents)
self.assertIn('My brilliant spec', contents)
@@ -2087,7 +2085,7 @@ class TestCommentCollapseVisibility(TestCaseWithFactory):
bug = self.makeBugWithComments(20)
url = canonical_url(bug.default_bugtask)
browser = self.getUserBrowser(url=url)
- contents = six.ensure_text(browser.contents)
+ contents = browser.contents
self.assertIn("10 comments hidden", contents)
self.assertEqual(1, contents.count('comments hidden'))
@@ -2100,7 +2098,7 @@ class TestCommentCollapseVisibility(TestCaseWithFactory):
removeSecurityProxy(comments[-5]).visible = False
browser = self.getUserBrowser(url=url)
- contents = six.ensure_text(browser.contents)
+ contents = browser.contents
self.assertIn("10 comments hidden", contents)
self.assertIn("1 comments hidden", contents)
self.assertEqual(2, contents.count('comments hidden'))
@@ -2122,7 +2120,7 @@ class TestCommentCollapseVisibility(TestCaseWithFactory):
transaction.commit()
browser = self.getUserBrowser(url=url)
- contents = six.ensure_text(browser.contents)
+ contents = browser.contents
self.assertIn("10 comments hidden", contents)
self.assertIn("1 comments hidden", contents)
self.assertEqual(2, contents.count('comments hidden'))
diff --git a/lib/lp/bugs/stories/bugs/xx-bug-comments-truncated.txt b/lib/lp/bugs/stories/bugs/xx-bug-comments-truncated.txt
index 1bef19e..9109c7d 100644
--- a/lib/lp/bugs/stories/bugs/xx-bug-comments-truncated.txt
+++ b/lib/lp/bugs/stories/bugs/xx-bug-comments-truncated.txt
@@ -109,7 +109,7 @@ the same rules as xx-question-message.txt; changes here may require
changes to that test.
>>> user_browser.open('http://bugs.launchpad.test/tomcat/+bug/2')
- >>> print(six.ensure_text(user_browser.title))
+ >>> print(user_browser.title)
Bug #2 (blackhole) ... : Bugs : Tomcat
>>> user_browser.getControl(name='field.comment').value = (
... "-----BEGIN PGP SIGNED MESSAGE-----\n"
@@ -142,7 +142,7 @@ changes to that test.
No Privileges Person is authenticated in user_browser, so they can see
email addresses in messages.
- >>> print(six.ensure_text(user_browser.title))
+ >>> print(user_browser.title)
Bug #2 (blackhole) ... : Bugs : Tomcat
>>> text = find_tags_by_class(
... user_browser.contents, 'boardCommentBody')[-1]
@@ -157,7 +157,7 @@ address, '<email address hidden>'. The anonymous user is
unauthenticated, so they will see the obfuscated email address.
>>> anon_browser.open('http://bugs.launchpad.test/tomcat/+bug/2')
- >>> print(six.ensure_text(anon_browser.title))
+ >>> print(anon_browser.title)
Bug #2 (blackhole) ... : Bugs : Tomcat
>>> text = find_tags_by_class(
... anon_browser.contents, 'boardCommentBody')[-1]
diff --git a/lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt b/lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt
index f25404c..8300668 100644
--- a/lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt
+++ b/lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt
@@ -63,7 +63,7 @@ For example, users can view a textual description of bug 1:
The textual description contains basic information about that bug, along with
all tasks related to that bug, presented in an easy-to-digest format:
- >>> text_bug = six.ensure_text(anon_browser.contents)
+ >>> text_bug = anon_browser.contents
>>> print(text_bug)
bug: 1
title: Firefox does not support SVG
@@ -191,7 +191,7 @@ description of bug 1 directly from the Mozilla Firefox-specific text page:
The textual report contains the same information as the report provided by the
parent bug context:
- >>> text_bug_task = six.ensure_text(anon_browser.contents)
+ >>> text_bug_task = anon_browser.contents
>>> print(text_bug_task)
bug: 1
title: Firefox does not support SVG
diff --git a/lib/lp/code/browser/tests/test_codereviewcomment.py b/lib/lp/code/browser/tests/test_codereviewcomment.py
index ac402fe..c7557b7 100644
--- a/lib/lp/code/browser/tests/test_codereviewcomment.py
+++ b/lib/lp/code/browser/tests/test_codereviewcomment.py
@@ -5,7 +5,6 @@
import re
-import six
from soupmatchers import (
HTMLContains,
Tag,
@@ -194,7 +193,7 @@ class TestCodeReviewCommentHtmlMixin:
comment = self.makeCodeReviewComment(body='\u1234')
browser = self.getViewBrowser(comment, view_name='+download')
contents = '\u1234'.encode()
- self.assertEqual(contents, six.ensure_binary(browser.contents))
+ self.assertEqual(contents, browser.contents.encode())
self.assertEqual(
'text/plain;charset=utf-8', browser.headers['Content-type'])
self.assertEqual(
diff --git a/lib/lp/registry/browser/tests/test_person.py b/lib/lp/registry/browser/tests/test_person.py
index 2f5eb23..1d43c17 100644
--- a/lib/lp/registry/browser/tests/test_person.py
+++ b/lib/lp/registry/browser/tests/test_person.py
@@ -9,7 +9,6 @@ from textwrap import dedent
from urllib.parse import urljoin
from fixtures import FakeLogger
-import six
import soupmatchers
from storm.store import Store
from testscenarios import (
@@ -326,8 +325,7 @@ class TestPersonIndexView(BrowserTestCase):
person, view_name='+close-account', user=admin)
browser.getControl("Close").click()
self.assertIn(
- "This account will now be permanently closed.",
- six.ensure_text(browser.contents))
+ "This account will now be permanently closed.", browser.contents)
# the close account job is created with Waiting status
job_source = getUtility(IPersonCloseAccountJobSource)
@@ -345,7 +343,7 @@ class TestPersonIndexView(BrowserTestCase):
browser.getControl("Close").click()
self.assertIn(
"This account will now be permanently closed.",
- six.ensure_text(browser.contents))
+ browser.contents)
# the close account job is created with Waiting status
job_source = getUtility(IPersonCloseAccountJobSource)
with person_logged_in(admin):
@@ -1591,8 +1589,7 @@ class TestPersonOCIRegistryCredentialsView(
password_control.value = 'newpassword'
browser.getControl("Save").click()
- self.assertIn(
- "Passwords do not match.", six.ensure_text(browser.contents))
+ self.assertIn("Passwords do not match.", browser.contents)
# change all fields (except region) with one edit action
username_control = browser.getControl(
@@ -1701,7 +1698,7 @@ class TestPersonOCIRegistryCredentialsView(
browser.getControl("Save").click()
self.assertIn("These credentials cannot be deleted as there are "
"push rules defined that still use them.",
- six.ensure_text(browser.contents))
+ browser.contents)
# make sure we don't have any push rules defined to use
# the credentials we want to remove
diff --git a/lib/lp/registry/stories/announcements/xx-announcements.txt b/lib/lp/registry/stories/announcements/xx-announcements.txt
index 8623b80..7115cba 100644
--- a/lib/lp/registry/stories/announcements/xx-announcements.txt
+++ b/lib/lp/registry/stories/announcements/xx-announcements.txt
@@ -717,23 +717,19 @@ hosted in Launchpad:
>>> nopriv_browser.open(
... 'http://feeds.launchpad.test/announcements.atom')
>>> _ = feedparser.parse(nopriv_browser.contents)
- >>> 'Announcements published via Launchpad' in (
- ... six.ensure_text(nopriv_browser.contents))
+ >>> 'Announcements published via Launchpad' in nopriv_browser.contents
True
- >>> '[tomcat] Tomcat announcement headline' in (
- ... six.ensure_text(nopriv_browser.contents))
+ >>> '[tomcat] Tomcat announcement headline' in nopriv_browser.contents
True
- >>> '[apache] Modified headline' in (
- ... six.ensure_text(nopriv_browser.contents))
+ >>> '[apache] Modified headline' in nopriv_browser.contents
True
It excludes retracted and future announcements too:
>>> "[guadalinex] Kubuntu announcement headline" in (
- ... six.ensure_text(nopriv_browser.contents))
+ ... nopriv_browser.contents)
False
- >>> "[jokosher] Jokosher announcement headline" in (
- ... six.ensure_text(nopriv_browser.contents))
+ >>> "[jokosher] Jokosher announcement headline" in nopriv_browser.contents
False
The announcements are stored as plain text, but the text-to-html formatter
diff --git a/lib/lp/registry/stories/object/xx-nameblacklist.txt b/lib/lp/registry/stories/object/xx-nameblacklist.txt
index 737e702..ff4b83c 100644
--- a/lib/lp/registry/stories/object/xx-nameblacklist.txt
+++ b/lib/lp/registry/stories/object/xx-nameblacklist.txt
@@ -60,5 +60,5 @@ happily without generating
>>> admin_browser.getControl('Save').click()
>>> print_feedback_messages(admin_browser.contents)
- >>> "has been blocked" in six.ensure_text(admin_browser.contents)
+ >>> "has been blocked" in admin_browser.contents
False
diff --git a/lib/lp/registry/stories/team-polls/edit-poll.txt b/lib/lp/registry/stories/team-polls/edit-poll.txt
index c811998..44435f8 100644
--- a/lib/lp/registry/stories/team-polls/edit-poll.txt
+++ b/lib/lp/registry/stories/team-polls/edit-poll.txt
@@ -89,7 +89,7 @@ It's also not possible to edit a poll that's already closed.
>>> team_admin_browser.url
'http://launchpad.test/~ubuntu-team/+poll/director-2004'
- >>> 'Voting has closed' in six.ensure_text(team_admin_browser.contents)
+ >>> 'Voting has closed' in team_admin_browser.contents
True
>>> team_admin_browser.getLink('Change details').click()
diff --git a/lib/lp/registry/stories/team-polls/vote-poll.txt b/lib/lp/registry/stories/team-polls/vote-poll.txt
index 54575b6..186f73d 100644
--- a/lib/lp/registry/stories/team-polls/vote-poll.txt
+++ b/lib/lp/registry/stories/team-polls/vote-poll.txt
@@ -80,8 +80,7 @@ yet.
... auth='Basic jeff.waugh@xxxxxxxxxxxxxxx:test')
>>> team_admin_browser.open(
... 'http://launchpad.test/~ubuntu-team/+poll/never-closes/+vote')
- >>> not_yet_voted_message = 'You have not yet voted in this poll.'
- >>> not_yet_voted_message in six.ensure_text(team_admin_browser.contents)
+ >>> 'You have not yet voted in this poll.' in team_admin_browser.contents
True
>>> team_admin_browser.getControl(name='newoption').value = ["donotvote"]
diff --git a/lib/lp/registry/stories/team/xx-team-contactemail-xss.txt b/lib/lp/registry/stories/team/xx-team-contactemail-xss.txt
index 45fb915..b27a150 100644
--- a/lib/lp/registry/stories/team/xx-team-contactemail-xss.txt
+++ b/lib/lp/registry/stories/team/xx-team-contactemail-xss.txt
@@ -38,6 +38,5 @@ The error message is also valid and correctly escaped:
The script we tried to inject is not present, unescaped, anywhere in
the page:
- >>> '<script>alert("cheezburger");</script>' in (
- ... six.ensure_text(admin_browser.contents))
+ >>> '<script>alert("cheezburger");</script>' in admin_browser.contents
False
diff --git a/lib/lp/registry/stories/team/xx-team-membership.txt b/lib/lp/registry/stories/team/xx-team-membership.txt
index 96f26e6..d90f86c 100644
--- a/lib/lp/registry/stories/team/xx-team-membership.txt
+++ b/lib/lp/registry/stories/team/xx-team-membership.txt
@@ -1,7 +1,7 @@
Start out by verifying the members page is sane.
>>> browser.open('http://launchpad.test/~ubuntu-team/+members')
- >>> 'Ubuntu Team' in six.ensure_text(browser.contents)
+ >>> 'Ubuntu Team' in browser.contents
True
Let's take a look at Colin's subscription page. Colin is an
@@ -14,7 +14,7 @@ administrator and his subscription never expires.
>>> print(browser.title)
Colin Watson's membership : ...Ubuntu Team... team
- >>> "Active member" in six.ensure_text(browser.contents)
+ >>> "Active member" in browser.contents
True
>>> browser.getControl(name='admin').value
['yes']
@@ -126,7 +126,7 @@ the administrator control on the membership page.
>>> print(jdub_browser.title)
Jeff Waugh's membership : ...Ubuntu Team... team
- >>> "Active member" in six.ensure_text(jdub_browser.contents)
+ >>> "Active member" in jdub_browser.contents
True
>>> jdub_browser.getControl(name='admin').value = ['no']
@@ -148,7 +148,7 @@ that the page works and that foo.bar@canonical can access it.
>>> browser.open('http://launchpad.test/~guadamen/+member/name12/')
- >>> 'Declined member' in six.ensure_text(browser.contents)
+ >>> 'Declined member' in browser.contents
True
Dave Miller is a proposed member in Ubuntu Gnome Team.
@@ -187,7 +187,7 @@ But in the second browser with the stale data we get an error message:
>>> message = (
... 'The membership request for Dave Miller has already been '
... 'processed')
- >>> message in six.ensure_text(second_browser.contents)
+ >>> message in second_browser.contents
True
An admin can see the former members of the team.