← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-testbrowser-excessive-bytes into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-testbrowser-excessive-bytes into launchpad:master.

Commit message:
Fix excessive bytes conversion with zope.testbrowser.browser

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

These literals were unnecessarily changed to bytes in earlier unicode_literals conversions (or possibly something in the zope.testbrowser stack has been fixed since then, I'm not quite sure).  Python 3 works better if we pass text strings, and Python 2 mostly works fine with that as well with the exception of two cases where we need a native string instead.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-testbrowser-excessive-bytes into launchpad:master.
diff --git a/lib/lp/answers/stories/question-browse-and-search.txt b/lib/lp/answers/stories/question-browse-and-search.txt
index 0abf0ed..e537ec6 100644
--- a/lib/lp/answers/stories/question-browse-and-search.txt
+++ b/lib/lp/answers/stories/question-browse-and-search.txt
@@ -541,7 +541,7 @@ questions to a particular status:
     >>> browser.open('http://launchpad.test/~name16/+questions')
     >>> browser.getControl(name='field.search_text').value = 'Firefox'
     >>> browser.getControl(name='field.status').displayValue = [
-    ...     b'Solved', b'Invalid']
+    ...     'Solved', 'Invalid']
     >>> browser.getControl('Search', index=0).click()
     >>> questions = find_tag_by_id(browser.contents, 'question-listing')
     >>> for question in questions.findAll('td', 'questionTITLE'):
@@ -732,7 +732,7 @@ Only the default set of statuses is searched:
 
 When no results are found, a message informs the user of this fact:
 
-    >>> browser.getControl(name='field.status').displayValue = [b'Expired']
+    >>> browser.getControl(name='field.status').displayValue = ['Expired']
     >>> browser.getControl('Search', index=0).click()
 
     >>> print(find_main_content(
@@ -742,7 +742,7 @@ When no results are found, a message informs the user of this fact:
 Clicking the 'Search' button without entering any search text will
 display all questions asked in Launchpad with the selected statuses.
 
-    >>> browser.getControl(name='field.status').displayValue = [b'Open']
+    >>> browser.getControl(name='field.status').displayValue = ['Open']
     >>> browser.getControl(name='field.search_text').value = ''
     >>> browser.getControl('Search', index=0).click()
 
diff --git a/lib/lp/bugs/stories/bugs/xx-bug-personal-subscriptions-advanced-features.txt b/lib/lp/bugs/stories/bugs/xx-bug-personal-subscriptions-advanced-features.txt
index 0e07632..ec1a88b 100644
--- a/lib/lp/bugs/stories/bugs/xx-bug-personal-subscriptions-advanced-features.txt
+++ b/lib/lp/bugs/stories/bugs/xx-bug-personal-subscriptions-advanced-features.txt
@@ -24,8 +24,8 @@ The user can subscribe to the bug at any of the given notification levels. In
 this case, they want to subscribe to just metadata updates:
 
     >>> bug_notification_level_control.getControl(
-    ...     b'any change is made to this bug, other than a new comment '
-    ...     b'being added').click()
+    ...     'any change is made to this bug, other than a new comment '
+    ...     'being added').click()
     >>> user_browser.getControl('Continue').click()
 
     >>> for message in find_tags_by_class(user_browser.contents, 'message'):
diff --git a/lib/lp/bugs/stories/bugs/xx-bugs-advanced-search-upstream-status.txt b/lib/lp/bugs/stories/bugs/xx-bugs-advanced-search-upstream-status.txt
index a238277..cdbc150 100644
--- a/lib/lp/bugs/stories/bugs/xx-bugs-advanced-search-upstream-status.txt
+++ b/lib/lp/bugs/stories/bugs/xx-bugs-advanced-search-upstream-status.txt
@@ -26,7 +26,7 @@ doesn't have a bug watch.
     >>> upstream_status = anon_browser.getControl(
     ...     name='field.status_upstream')
     >>> upstream_status.displayValue = [
-    ...     b'Show bugs that need to be forwarded to an upstream bug tracker']
+    ...     'Show bugs that need to be forwarded to an upstream bug tracker']
     >>> anon_browser.getControl('Search', index=0).click()
     >>> print_bugtasks(anon_browser.contents)
     2 Blackhole Trash folder Ubuntu Medium New
@@ -64,7 +64,7 @@ are not included in the report.
     >>> upstream_status = anon_browser.getControl(
     ...     name='field.status_upstream')
     >>> upstream_status.displayValue = [
-    ...     b'Show bugs that need to be forwarded to an upstream bug tracker']
+    ...     'Show bugs that need to be forwarded to an upstream bug tracker']
     >>> anon_browser.getControl('Search', index=0).click()
     >>> print(anon_browser.contents)
     <!DOCTYPE...
@@ -79,7 +79,7 @@ on upstream, to focus instead on things they need to work on.
     >>> upstream_status = anon_browser.getControl(
     ...     name='field.status_upstream')
     >>> upstream_status.displayValue = [
-    ...     b'Show bugs that are not known to affect upstream']
+    ...     'Show bugs that are not known to affect upstream']
     >>> anon_browser.getControl('Search', index=0).click()
     >>> print_bugtasks(anon_browser.contents)
     10 another test bug linux-source-2.6.15 (Ubuntu) Medium New
@@ -110,7 +110,7 @@ modified and the sampledata we created above will show up.
     >>> upstream_status = anon_browser.getControl(
     ...     name='field.status_upstream')
     >>> upstream_status.displayValue = [
-    ...     b'Show bugs that are resolved upstream']
+    ...     'Show bugs that are resolved upstream']
     >>> anon_browser.getControl('Search', index=0).click()
     >>> print_bugtasks(anon_browser.contents)
     1 Firefox does not support SVG mozilla-firefox (Ubuntu) Medium New
@@ -124,8 +124,8 @@ returns the union of the results for the individual filters.
     >>> upstream_status = anon_browser.getControl(
     ...     name='field.status_upstream')
     >>> upstream_status.displayValue = [
-    ...     b'Show bugs that are resolved upstream',
-    ...     b'Show bugs that are not known to affect upstream'
+    ...     'Show bugs that are resolved upstream',
+    ...     'Show bugs that are not known to affect upstream'
     ...     ]
 
     >>> anon_browser.getControl('Search', index=0).click()
diff --git a/lib/lp/bugs/stories/bugtracker/xx-bugtracker.txt b/lib/lp/bugs/stories/bugtracker/xx-bugtracker.txt
index 443f5d2..44e88a4 100644
--- a/lib/lp/bugs/stories/bugtracker/xx-bugtracker.txt
+++ b/lib/lp/bugs/stories/bugtracker/xx-bugtracker.txt
@@ -236,7 +236,7 @@ informative error message explaining why it is invalid.
     "what? my wife does this stuff" is not a valid URI
 
     >>> user_browser.getControl('Location', index=0).value = (
-    ...     b'http://ξνεr.been.fishing?')
+    ...     'http://ξνεr.been.fishing?')
     >>> user_browser.getControl('Change').click()
 
     >>> print_feedback_messages(user_browser.contents)
@@ -351,7 +351,7 @@ shown informative error messages.
     >>> user_browser.open(
     ...     'http://launchpad.test/bugs/bugtrackers/testbugzilla/+edit')
     >>> user_browser.getControl('Location aliases').value = (
-    ...     b'ξνεr been http://fishing?')
+    ...     'ξνεr been http://fishing?')
     >>> user_browser.getControl('Change').click()
 
     >>> print_feedback_messages(user_browser.contents)
diff --git a/lib/lp/translations/stories/standalone/xx-language.txt b/lib/lp/translations/stories/standalone/xx-language.txt
index 63b80d7..0606191 100644
--- a/lib/lp/translations/stories/standalone/xx-language.txt
+++ b/lib/lp/translations/stories/standalone/xx-language.txt
@@ -279,8 +279,9 @@ Changing values to correct content works:
     >>> admin_browser.getControl('ISO 639').value = 'bars'
     >>> admin_browser.getControl('English name').value = 'Changed field'
     >>> spokenin_control = admin_browser.getControl(name='field.countries')
-    >>> spokenin_control.getControl(b'Argentina').selected = False
-    >>> spokenin_control.getControl(b'France').selected = True
+    >>> spokenin_control.getControl(
+    ...     six.ensure_str('Argentina')).selected = False
+    >>> spokenin_control.getControl(six.ensure_str('France')).selected = True
     >>> admin_browser.getControl('Admin Language').click()
     >>> print(admin_browser.url)
     http://translations.launchpad.test/+languages/bars