Merge ~cjwatson/launchpad:pyupgrade-py3-registry-3 into launchpad:master
- Git
- lp:~cjwatson/launchpad
- pyupgrade-py3-registry-3
- Merge into master
Proposed by
Colin Watson
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | 8b5c61aa46d13ff1dbc4fb705f75b46070f61e6d |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:pyupgrade-py3-registry-3 |
Merge into: | launchpad:master |
Diff against target: |
4329 lines (+595/-610) 67 files modified
.git-blame-ignore-revs (+2/-0) .pre-commit-config.yaml (+1/-1) lib/lp/registry/mail/notification.py (+8/-8) lib/lp/registry/mail/teammembership.py (+3/-5) lib/lp/registry/personmerge.py (+2/-2) lib/lp/registry/services/sharingservice.py (+1/-2) lib/lp/registry/services/tests/test_sharingservice.py (+4/-4) lib/lp/registry/tests/mailinglists_helper.py (+6/-9) lib/lp/registry/tests/test_accesspolicy.py (+1/-1) lib/lp/registry/tests/test_add_member.py (+1/-1) lib/lp/registry/tests/test_codeofconduct.py (+2/-2) lib/lp/registry/tests/test_commercialprojects_vocabularies.py (+11/-11) lib/lp/registry/tests/test_distribution.py (+12/-12) lib/lp/registry/tests/test_distributionmirror.py (+1/-1) lib/lp/registry/tests/test_distributionmirror_prober.py (+23/-26) lib/lp/registry/tests/test_distributionsourcepackage.py (+1/-1) lib/lp/registry/tests/test_distro_webservice.py (+1/-1) lib/lp/registry/tests/test_distroseries.py (+11/-11) lib/lp/registry/tests/test_distroseries_vocabularies.py (+1/-1) lib/lp/registry/tests/test_distroseriesdifference.py (+5/-5) lib/lp/registry/tests/test_initderiveddistroseries.py (+5/-5) lib/lp/registry/tests/test_listteammembers.py (+40/-40) lib/lp/registry/tests/test_mailinglist.py (+2/-2) lib/lp/registry/tests/test_mailinglistapi.py (+14/-14) lib/lp/registry/tests/test_membership_notification_job.py (+1/-1) lib/lp/registry/tests/test_milestone.py (+3/-3) lib/lp/registry/tests/test_milestone_vocabularies.py (+8/-8) lib/lp/registry/tests/test_milestonetag.py (+15/-15) lib/lp/registry/tests/test_mlists.py (+44/-44) lib/lp/registry/tests/test_nameblacklist.py (+36/-36) lib/lp/registry/tests/test_notification.py (+2/-2) lib/lp/registry/tests/test_ociproject.py (+2/-3) lib/lp/registry/tests/test_ociprojectseries.py (+2/-3) lib/lp/registry/tests/test_oopsreferences.py (+6/-6) lib/lp/registry/tests/test_person.py (+33/-33) lib/lp/registry/tests/test_person_close_account_job.py (+10/-10) lib/lp/registry/tests/test_person_merge_job.py (+1/-1) lib/lp/registry/tests/test_person_sort_key.py (+14/-14) lib/lp/registry/tests/test_person_vocabularies.py (+7/-7) lib/lp/registry/tests/test_personmerge.py (+28/-28) lib/lp/registry/tests/test_personnotification.py (+11/-11) lib/lp/registry/tests/test_personroles.py (+1/-1) lib/lp/registry/tests/test_personset.py (+122/-122) lib/lp/registry/tests/test_persontransferjob.py (+1/-1) lib/lp/registry/tests/test_pillar.py (+2/-2) lib/lp/registry/tests/test_pillar_vocabularies.py (+3/-3) lib/lp/registry/tests/test_poll.py (+2/-2) lib/lp/registry/tests/test_prf_finder.py (+2/-2) lib/lp/registry/tests/test_prf_walker.py (+5/-5) lib/lp/registry/tests/test_private_team_visibility.py (+1/-1) lib/lp/registry/tests/test_product.py (+17/-17) lib/lp/registry/tests/test_product_vocabularies.py (+1/-1) lib/lp/registry/tests/test_productrelease.py (+1/-1) lib/lp/registry/tests/test_productseries.py (+3/-3) lib/lp/registry/tests/test_productseries_vocabularies.py (+1/-1) lib/lp/registry/tests/test_project_milestone.py (+5/-5) lib/lp/registry/tests/test_projectgroup.py (+2/-2) lib/lp/registry/tests/test_service_usage.py (+6/-6) lib/lp/registry/tests/test_sharingjob.py (+1/-1) lib/lp/registry/tests/test_sourcepackage.py (+3/-3) lib/lp/registry/tests/test_sourcepackagename_vocabulary.py (+1/-1) lib/lp/registry/tests/test_team.py (+5/-5) lib/lp/registry/tests/test_team_webservice.py (+1/-1) lib/lp/registry/tests/test_teammembership.py (+11/-11) lib/lp/registry/tests/test_teammembership_webservice.py (+1/-1) lib/lp/registry/tests/test_xmlrpc.py (+3/-3) lib/lp/registry/vocabularies.py (+13/-19) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Review via email: mp+413511@code.launchpad.net |
Commit message
lp.registry: Apply "pyupgrade --py3-plus"
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs |
2 | index a7862ac..970ac3b 100644 |
3 | --- a/.git-blame-ignore-revs |
4 | +++ b/.git-blame-ignore-revs |
5 | @@ -32,3 +32,5 @@ fbed83f22424df8fa5647349493f78937a520db5 |
6 | 9c1665b1dfed3f6abf69afa192700172ea3089a1 |
7 | # apply pyupgrade --py3-plus to lp.registry.{interfaces,model,scripts} |
8 | 94fc9e2ad28375faa98c524f66768a0b57a4b821 |
9 | +# apply pyupgrade --py3-plus to lp.registry |
10 | +7c02bb8d73dd3875e338ba7945d3f7f86d1fc743 |
11 | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml |
12 | index a9e2726..9b69a4f 100644 |
13 | --- a/.pre-commit-config.yaml |
14 | +++ b/.pre-commit-config.yaml |
15 | @@ -52,7 +52,7 @@ repos: |
16 | |codehosting |
17 | |coop |
18 | |oci |
19 | - |registry/(browser|interfaces|model|scripts) |
20 | + |registry |
21 | )/ |
22 | - repo: https://github.com/PyCQA/isort |
23 | rev: 5.9.2 |
24 | diff --git a/lib/lp/registry/mail/notification.py b/lib/lp/registry/mail/notification.py |
25 | index 909e37d..ad9e73a 100644 |
26 | --- a/lib/lp/registry/mail/notification.py |
27 | +++ b/lib/lp/registry/mail/notification.py |
28 | @@ -195,14 +195,14 @@ def send_direct_contact_email( |
29 | # uses those anyway!? The only alternative is to attach the footer as a |
30 | # MIME attachment with a us-ascii charset, but that has it's own set of |
31 | # problems (and user complaints). Email sucks. |
32 | - additions = u'\n'.join([ |
33 | - u'', |
34 | - u'-- ', |
35 | - u'This message was sent from Launchpad by', |
36 | - u'%s (%s)' % (sender_name, canonical_url(sender)), |
37 | - u'%s.', |
38 | - u'For more information see', |
39 | - u'https://help.launchpad.net/YourAccount/ContactingPeople', |
40 | + additions = '\n'.join([ |
41 | + '', |
42 | + '-- ', |
43 | + 'This message was sent from Launchpad by', |
44 | + '%s (%s)' % (sender_name, canonical_url(sender)), |
45 | + '%s.', |
46 | + 'For more information see', |
47 | + 'https://help.launchpad.net/YourAccount/ContactingPeople', |
48 | ]) |
49 | # Craft and send one message per recipient. |
50 | mailwrapper = MailWrapper(width=72) |
51 | diff --git a/lib/lp/registry/mail/teammembership.py b/lib/lp/registry/mail/teammembership.py |
52 | index 452ca59..926d88d 100644 |
53 | --- a/lib/lp/registry/mail/teammembership.py |
54 | +++ b/lib/lp/registry/mail/teammembership.py |
55 | @@ -82,8 +82,7 @@ class TeamMembershipRecipientReason(RecipientReason): |
56 | def __init__(self, subscriber, recipient, mail_header, reason_template, |
57 | subject=None, template_name=None, reply_to=None, |
58 | recipient_class=None): |
59 | - super(TeamMembershipRecipientReason, self).__init__( |
60 | - subscriber, recipient, mail_header, reason_template) |
61 | + super().__init__(subscriber, recipient, mail_header, reason_template) |
62 | self.subject = subject |
63 | self.template_name = template_name |
64 | self.reply_to = reply_to |
65 | @@ -364,7 +363,7 @@ class TeamMembershipMailer(BaseMailer): |
66 | notification_type, member, team, reviewer, membership=None, |
67 | extra_params={}, wrap=True, force_wrap=True): |
68 | """See `BaseMailer`.""" |
69 | - super(TeamMembershipMailer, self).__init__( |
70 | + super().__init__( |
71 | subject, template_name, recipients, from_address, |
72 | notification_type=notification_type, wrap=wrap, |
73 | force_wrap=force_wrap) |
74 | @@ -399,8 +398,7 @@ class TeamMembershipMailer(BaseMailer): |
75 | |
76 | def _getTemplateParams(self, email, recipient): |
77 | """See `BaseMailer`.""" |
78 | - params = super(TeamMembershipMailer, self)._getTemplateParams( |
79 | - email, recipient) |
80 | + params = super()._getTemplateParams(email, recipient) |
81 | params["recipient"] = recipient.displayname |
82 | reason, _ = self._recipients.getReason(email) |
83 | if reason.recipient_class is not None: |
84 | diff --git a/lib/lp/registry/personmerge.py b/lib/lp/registry/personmerge.py |
85 | index 9c39b76..2cef92b 100644 |
86 | --- a/lib/lp/registry/personmerge.py |
87 | +++ b/lib/lp/registry/personmerge.py |
88 | @@ -1037,11 +1037,11 @@ def merge_people(from_person, to_person, reviewer, delete=False): |
89 | if to_person.is_team: |
90 | mail_text = get_email_template( |
91 | 'team-merged.txt', app='registry') |
92 | - subject = u'Launchpad teams merged' |
93 | + subject = 'Launchpad teams merged' |
94 | else: |
95 | mail_text = get_email_template( |
96 | 'person-merged.txt', app='registry') |
97 | - subject = u'Launchpad accounts merged' |
98 | + subject = 'Launchpad accounts merged' |
99 | mail_text = mail_text % { |
100 | 'dupename': from_person.name, |
101 | 'person': to_person.name, |
102 | diff --git a/lib/lp/registry/services/sharingservice.py b/lib/lp/registry/services/sharingservice.py |
103 | index 7384df4..dda0934 100644 |
104 | --- a/lib/lp/registry/services/sharingservice.py |
105 | +++ b/lib/lp/registry/services/sharingservice.py |
106 | @@ -12,7 +12,6 @@ from operator import attrgetter |
107 | |
108 | from lazr.restful.interfaces import IWebBrowserOriginatingRequest |
109 | from lazr.restful.utils import get_current_web_service_request |
110 | -import six |
111 | from storm.expr import ( |
112 | And, |
113 | Count, |
114 | @@ -679,7 +678,7 @@ class SharingService: |
115 | for (grantee, permissions, shared_artifact_types) in grant_permissions: |
116 | some_things_shared = len(shared_artifact_types) > 0 |
117 | grantee_permissions = {} |
118 | - for (policy, permission) in six.iteritems(permissions): |
119 | + for (policy, permission) in permissions.items(): |
120 | grantee_permissions[policy.type.name] = permission.name |
121 | shared_artifact_type_names = [ |
122 | info_type.name for info_type in shared_artifact_types] |
123 | diff --git a/lib/lp/registry/services/tests/test_sharingservice.py b/lib/lp/registry/services/tests/test_sharingservice.py |
124 | index e0accd8..858dfd3 100644 |
125 | --- a/lib/lp/registry/services/tests/test_sharingservice.py |
126 | +++ b/lib/lp/registry/services/tests/test_sharingservice.py |
127 | @@ -68,7 +68,7 @@ class TestSharingService(TestCaseWithFactory, OCIConfigHelperMixin): |
128 | layer = CeleryJobLayer |
129 | |
130 | def setUp(self): |
131 | - super(TestSharingService, self).setUp() |
132 | + super().setUp() |
133 | self.service = getUtility(IService, 'sharing') |
134 | # Set test flags and configurations for Snaps and OCI. |
135 | flags = SNAP_TESTING_FLAGS.copy() |
136 | @@ -2004,7 +2004,7 @@ class ApiTestMixin: |
137 | """Common tests for launchpadlib and webservice.""" |
138 | |
139 | def setUp(self): |
140 | - super(ApiTestMixin, self).setUp() |
141 | + super().setUp() |
142 | self.owner = self.factory.makePerson(name='thundercat') |
143 | self.pillar = self.factory.makeProduct( |
144 | owner=self.owner, specification_sharing_policy=( |
145 | @@ -2055,7 +2055,7 @@ class TestWebService(ApiTestMixin, WebServiceTestCase): |
146 | """Test the web service interface for the Sharing Service.""" |
147 | |
148 | def setUp(self): |
149 | - super(TestWebService, self).setUp() |
150 | + super().setUp() |
151 | self.webservice = LaunchpadWebServiceCaller( |
152 | 'launchpad-library', 'salgado-change-anything') |
153 | self._sharePillarInformation(self.pillar) |
154 | @@ -2102,7 +2102,7 @@ class TestLaunchpadlib(ApiTestMixin, TestCaseWithFactory): |
155 | layer = AppServerLayer |
156 | |
157 | def setUp(self): |
158 | - super(TestLaunchpadlib, self).setUp() |
159 | + super().setUp() |
160 | self.launchpad = self.factory.makeLaunchpadService(person=self.owner) |
161 | self.service = self.launchpad.load('+services/sharing') |
162 | transaction.commit() |
163 | diff --git a/lib/lp/registry/tests/mailinglists_helper.py b/lib/lp/registry/tests/mailinglists_helper.py |
164 | index 20ace5c..a6d53d5 100644 |
165 | --- a/lib/lp/registry/tests/mailinglists_helper.py |
166 | +++ b/lib/lp/registry/tests/mailinglists_helper.py |
167 | @@ -112,27 +112,24 @@ class MailingListXMLRPCTestProxy(MailingListAPIView): |
168 | |
169 | @fault_catcher |
170 | def getPendingActions(self): |
171 | - return super(MailingListXMLRPCTestProxy, self).getPendingActions() |
172 | + return super().getPendingActions() |
173 | |
174 | @fault_catcher |
175 | def reportStatus(self, statuses): |
176 | - return super(MailingListXMLRPCTestProxy, self).reportStatus(statuses) |
177 | + return super().reportStatus(statuses) |
178 | |
179 | @fault_catcher |
180 | def getMembershipInformation(self, teams): |
181 | - return super( |
182 | - MailingListXMLRPCTestProxy, self).getMembershipInformation(teams) |
183 | + return super().getMembershipInformation(teams) |
184 | |
185 | @fault_catcher |
186 | def isLaunchpadMember(self, address): |
187 | - return super(MailingListXMLRPCTestProxy, self).isLaunchpadMember( |
188 | - address) |
189 | + return super().isLaunchpadMember(address) |
190 | |
191 | @fault_catcher |
192 | def isTeamPublic(self, team_name): |
193 | - return super(MailingListXMLRPCTestProxy, self).isTeamPublic(team_name) |
194 | + return super().isTeamPublic(team_name) |
195 | |
196 | @fault_catcher |
197 | def updateTeamAddresses(self, old_hostname): |
198 | - return super(MailingListXMLRPCTestProxy, self).updateTeamAddresses( |
199 | - old_hostname) |
200 | + return super().updateTeamAddresses(old_hostname) |
201 | diff --git a/lib/lp/registry/tests/test_accesspolicy.py b/lib/lp/registry/tests/test_accesspolicy.py |
202 | index 99b6145..93d7d7f 100644 |
203 | --- a/lib/lp/registry/tests/test_accesspolicy.py |
204 | +++ b/lib/lp/registry/tests/test_accesspolicy.py |
205 | @@ -552,7 +552,7 @@ class TestAccessPolicyGrantFlatSource(TestCaseWithFactory): |
206 | layer = DatabaseFunctionalLayer |
207 | |
208 | def setUp(self): |
209 | - super(TestAccessPolicyGrantFlatSource, self).setUp() |
210 | + super().setUp() |
211 | self.apgfs = getUtility(IAccessPolicyGrantFlatSource) |
212 | |
213 | def _makePolicyGrants(self): |
214 | diff --git a/lib/lp/registry/tests/test_add_member.py b/lib/lp/registry/tests/test_add_member.py |
215 | index ec6748e..00fb26e 100644 |
216 | --- a/lib/lp/registry/tests/test_add_member.py |
217 | +++ b/lib/lp/registry/tests/test_add_member.py |
218 | @@ -15,7 +15,7 @@ class CircularMemberAdditionTestCase(TestCaseWithFactory): |
219 | layer = DatabaseFunctionalLayer |
220 | |
221 | def setUp(self): |
222 | - super(CircularMemberAdditionTestCase, self).setUp() |
223 | + super().setUp() |
224 | self.a_team = self.factory.makeTeam(name="a") |
225 | self.b_team = self.factory.makeTeam(name="b") |
226 | |
227 | diff --git a/lib/lp/registry/tests/test_codeofconduct.py b/lib/lp/registry/tests/test_codeofconduct.py |
228 | index cc61593..b9b8fed 100644 |
229 | --- a/lib/lp/registry/tests/test_codeofconduct.py |
230 | +++ b/lib/lp/registry/tests/test_codeofconduct.py |
231 | @@ -230,7 +230,7 @@ class TestSignedCodeOfConductSet(TestCaseWithFactory): |
232 | def test_affirmAndStore_incorrect_text(self): |
233 | user = self.factory.makePerson() |
234 | self.assertEqual( |
235 | - u"The affirmed text does not match the current Code of Conduct.", |
236 | + "The affirmed text does not match the current Code of Conduct.", |
237 | getUtility(ISignedCodeOfConductSet).affirmAndStore(user, "foo")) |
238 | |
239 | def test_affirmAndStore_existing(self): |
240 | @@ -241,7 +241,7 @@ class TestSignedCodeOfConductSet(TestCaseWithFactory): |
241 | user, current.content)) |
242 | |
243 | self.assertEqual( |
244 | - u"You have already affirmed the current Code of Conduct.", |
245 | + "You have already affirmed the current Code of Conduct.", |
246 | getUtility(ISignedCodeOfConductSet).affirmAndStore( |
247 | user, current.content)) |
248 | |
249 | diff --git a/lib/lp/registry/tests/test_commercialprojects_vocabularies.py b/lib/lp/registry/tests/test_commercialprojects_vocabularies.py |
250 | index a594d0c..6bdafd9 100644 |
251 | --- a/lib/lp/registry/tests/test_commercialprojects_vocabularies.py |
252 | +++ b/lib/lp/registry/tests/test_commercialprojects_vocabularies.py |
253 | @@ -20,7 +20,7 @@ class TestCommProjVocabulary(TestCaseWithFactory): |
254 | layer = DatabaseFunctionalLayer |
255 | |
256 | def setUp(self): |
257 | - super(TestCommProjVocabulary, self).setUp() |
258 | + super().setUp() |
259 | self.owner = self.factory.makePerson( |
260 | email_address_status=EmailAddressStatus.VALIDATED) |
261 | self._createProjects() |
262 | @@ -61,25 +61,25 @@ class TestCommProjVocabulary(TestCaseWithFactory): |
263 | |
264 | def test_searchForTerms_success(self): |
265 | # Search for active maintained projects success. |
266 | - results = self.vocab.searchForTerms(u'widget') |
267 | + results = self.vocab.searchForTerms('widget') |
268 | self.assertEqual( |
269 | self.num_commercial, len(results), |
270 | "Expected %d results but got %d." % (self.num_commercial, |
271 | len(results))) |
272 | # Ensure we get only those that match by searching for a single |
273 | # widget, using 't1', a subset of the name 'widget1'. |
274 | - results = self.vocab.searchForTerms(u't1') |
275 | + results = self.vocab.searchForTerms('t1') |
276 | self.assertEqual(1, len(results), |
277 | "Expected %d result but got %d." % (1, len(results))) |
278 | |
279 | def test_searchForTerms_fail(self): |
280 | # Search for deactivated or non-maintained projects fails. |
281 | - results = self.vocab.searchForTerms(u'norwegian-blue-widget') |
282 | + results = self.vocab.searchForTerms('norwegian-blue-widget') |
283 | self.assertEqual(0, len(results), |
284 | "Expected %d results but got %d." % |
285 | (0, len(results))) |
286 | |
287 | - results = self.vocab.searchForTerms(u'firefox') |
288 | + results = self.vocab.searchForTerms('firefox') |
289 | self.assertEqual(0, len(results), |
290 | "Expected %d results but got %d." % |
291 | (0, len(results))) |
292 | @@ -89,9 +89,9 @@ class TestCommProjVocabulary(TestCaseWithFactory): |
293 | expert = login_celebrity('commercial_admin') |
294 | self.vocab = CommercialProjectsVocabulary(context=expert) |
295 | self.assertEqual( |
296 | - 1, len(self.vocab.searchForTerms(u'open-widget'))) |
297 | + 1, len(self.vocab.searchForTerms('open-widget'))) |
298 | self.assertEqual( |
299 | - 0, len(self.vocab.searchForTerms(u'norwegian-blue-widget'))) |
300 | + 0, len(self.vocab.searchForTerms('norwegian-blue-widget'))) |
301 | |
302 | def test_toTerm(self): |
303 | # Commercial project terms contain subscription information. |
304 | @@ -103,27 +103,27 @@ class TestCommProjVocabulary(TestCaseWithFactory): |
305 | def test_getTermByToken_user(self): |
306 | # The term for a token in the vocabulary is returned for maintained |
307 | # projects. |
308 | - token = self.vocab.getTermByToken(u'open-widget') |
309 | + token = self.vocab.getTermByToken('open-widget') |
310 | self.assertEqual(self.maintained_project, token.value) |
311 | |
312 | def test_getTermByToken_commercial_admin(self): |
313 | # The term for a token in the vocabulary is returned for any |
314 | # active project. |
315 | login_celebrity('commercial_admin') |
316 | - token = self.vocab.getTermByToken(u'open-widget') |
317 | + token = self.vocab.getTermByToken('open-widget') |
318 | self.assertEqual(self.maintained_project, token.value) |
319 | |
320 | def test_getTermByToken_error_user(self): |
321 | # A LookupError is raised if the token is not in the vocabulary. |
322 | self.assertRaises( |
323 | - LookupError, self.vocab.getTermByToken, u'norwegian-blue-widget') |
324 | + LookupError, self.vocab.getTermByToken, 'norwegian-blue-widget') |
325 | |
326 | def test_getTermByToken_error_commercial_admin(self): |
327 | # The term for a token in the vocabulary is returned for any |
328 | # active project. |
329 | login_celebrity('commercial_admin') |
330 | self.assertRaises( |
331 | - LookupError, self.vocab.getTermByToken, u'norwegian-blue-widget') |
332 | + LookupError, self.vocab.getTermByToken, 'norwegian-blue-widget') |
333 | |
334 | def test_iter(self): |
335 | # The vocabulary can be iterated and the order is by displayname. |
336 | diff --git a/lib/lp/registry/tests/test_distribution.py b/lib/lp/registry/tests/test_distribution.py |
337 | index e19bde3..427d95e 100644 |
338 | --- a/lib/lp/registry/tests/test_distribution.py |
339 | +++ b/lib/lp/registry/tests/test_distribution.py |
340 | @@ -107,7 +107,7 @@ class TestDistribution(TestCaseWithFactory): |
341 | def test_distribution_repr_ansii(self): |
342 | # Verify that ANSI displayname is ascii safe. |
343 | distro = self.factory.makeDistribution( |
344 | - name="distro", displayname=u'\xdc-distro') |
345 | + name="distro", displayname='\xdc-distro') |
346 | ignore, displayname, name = repr(distro).rsplit(' ', 2) |
347 | self.assertEqual("'\\xdc-distro'", displayname) |
348 | self.assertEqual('(distro)>', name) |
349 | @@ -115,7 +115,7 @@ class TestDistribution(TestCaseWithFactory): |
350 | def test_distribution_repr_unicode(self): |
351 | # Verify that Unicode displayname is ascii safe. |
352 | distro = self.factory.makeDistribution( |
353 | - name="distro", displayname=u'\u0170-distro') |
354 | + name="distro", displayname='\u0170-distro') |
355 | ignore, displayname, name = repr(distro).rsplit(' ', 2) |
356 | self.assertEqual("'\\u0170-distro'", displayname) |
357 | |
358 | @@ -334,14 +334,14 @@ class TestDistribution(TestCaseWithFactory): |
359 | self.assertEqual(first_project, result[0]) |
360 | |
361 | def test_searchOCIProjects_by_partial_name(self): |
362 | - name = u'testpartialname' |
363 | + name = 'testpartialname' |
364 | distro = self.factory.makeDistribution() |
365 | first_name = self.factory.makeOCIProjectName(name=name) |
366 | first_project = self.factory.makeOCIProject( |
367 | pillar=distro, ociprojectname=first_name) |
368 | self.factory.makeOCIProject(pillar=distro) |
369 | |
370 | - result = distro.searchOCIProjects(text=u'partial') |
371 | + result = distro.searchOCIProjects(text='partial') |
372 | self.assertEqual(1, result.count()) |
373 | self.assertEqual(first_project, result[0]) |
374 | |
375 | @@ -518,7 +518,7 @@ class DistroSnapshotTestCase(TestCaseWithFactory): |
376 | layer = LaunchpadFunctionalLayer |
377 | |
378 | def setUp(self): |
379 | - super(DistroSnapshotTestCase, self).setUp() |
380 | + super().setUp() |
381 | self.distribution = self.factory.makeDistribution(name="boobuntu") |
382 | |
383 | def test_snapshot(self): |
384 | @@ -546,9 +546,9 @@ class TestDistributionPage(TestCaseWithFactory): |
385 | layer = DatabaseFunctionalLayer |
386 | |
387 | def setUp(self): |
388 | - super(TestDistributionPage, self).setUp('foo.bar@canonical.com') |
389 | + super().setUp('foo.bar@canonical.com') |
390 | self.distro = self.factory.makeDistribution( |
391 | - name="distro", displayname=u'distro') |
392 | + name="distro", displayname='distro') |
393 | self.admin = getUtility(IPersonSet).getByEmail( |
394 | 'admin@canonical.com') |
395 | self.simple_user = self.factory.makePerson() |
396 | @@ -627,7 +627,7 @@ class DistroRegistrantTestCase(TestCaseWithFactory): |
397 | layer = DatabaseFunctionalLayer |
398 | |
399 | def setUp(self): |
400 | - super(DistroRegistrantTestCase, self).setUp() |
401 | + super().setUp() |
402 | self.owner = self.factory.makePerson() |
403 | self.registrant = self.factory.makePerson() |
404 | |
405 | @@ -768,7 +768,7 @@ class TestDistributionWebservice(OCIConfigHelperMixin, TestCaseWithFactory): |
406 | layer = DatabaseFunctionalLayer |
407 | |
408 | def setUp(self): |
409 | - super(TestDistributionWebservice, self).setUp() |
410 | + super().setUp() |
411 | self.person = self.factory.makePerson( |
412 | displayname="Test Person") |
413 | self.webservice = webservice_for_person( |
414 | @@ -776,7 +776,7 @@ class TestDistributionWebservice(OCIConfigHelperMixin, TestCaseWithFactory): |
415 | default_api_version="devel") |
416 | |
417 | def test_searchOCIProjects(self): |
418 | - name = self.factory.getUniqueUnicode(u"partial-") |
419 | + name = self.factory.getUniqueUnicode("partial-") |
420 | with person_logged_in(self.person): |
421 | distro = self.factory.makeDistribution(owner=self.person) |
422 | first_name = self.factory.makeOCIProjectName(name=name) |
423 | @@ -804,7 +804,7 @@ class TestDistributionWebservice(OCIConfigHelperMixin, TestCaseWithFactory): |
424 | with person_logged_in(self.person): |
425 | distro = self.factory.makeDistribution() |
426 | self.factory.makeQuestion( |
427 | - title=u"Crash with %s" % oopsid, target=distro) |
428 | + title="Crash with %s" % oopsid, target=distro) |
429 | distro_url = api_url(distro) |
430 | |
431 | now = datetime.datetime.now(tz=pytz.utc) |
432 | @@ -829,7 +829,7 @@ class TestDistributionWebservice(OCIConfigHelperMixin, TestCaseWithFactory): |
433 | # check the filter is tight enough - other contexts should not work. |
434 | oopsid = "OOPS-abcdef1234" |
435 | with person_logged_in(self.person): |
436 | - self.factory.makeQuestion(title=u"Crash with %s" % oopsid) |
437 | + self.factory.makeQuestion(title="Crash with %s" % oopsid) |
438 | distro = self.factory.makeDistribution() |
439 | distro_url = api_url(distro) |
440 | now = datetime.datetime.now(tz=pytz.utc) |
441 | diff --git a/lib/lp/registry/tests/test_distributionmirror.py b/lib/lp/registry/tests/test_distributionmirror.py |
442 | index 8f1423d..e638311 100644 |
443 | --- a/lib/lp/registry/tests/test_distributionmirror.py |
444 | +++ b/lib/lp/registry/tests/test_distributionmirror.py |
445 | @@ -32,7 +32,7 @@ class TestDistributionMirror(TestCaseWithFactory): |
446 | layer = LaunchpadFunctionalLayer |
447 | |
448 | def setUp(self): |
449 | - super(TestDistributionMirror, self).setUp() |
450 | + super().setUp() |
451 | login('test@canonical.com') |
452 | mirrorset = getUtility(IDistributionMirrorSet) |
453 | self.cdimage_mirror = mirrorset.getByName('releases-mirror') |
454 | diff --git a/lib/lp/registry/tests/test_distributionmirror_prober.py b/lib/lp/registry/tests/test_distributionmirror_prober.py |
455 | index 0146ca4..8b9fd22 100644 |
456 | --- a/lib/lp/registry/tests/test_distributionmirror_prober.py |
457 | +++ b/lib/lp/registry/tests/test_distributionmirror_prober.py |
458 | @@ -133,8 +133,7 @@ class LocalhostWhitelistedHTTPSPolicy(BrowserLikePolicyForHTTPS): |
459 | # otherwise return the default policy |
460 | if hostname == b'localhost': |
461 | return ssl.CertificateOptions(verify=False) |
462 | - return super(LocalhostWhitelistedHTTPSPolicy, self).creatorForNetloc( |
463 | - hostname, port) |
464 | + return super().creatorForNetloc(hostname, port) |
465 | |
466 | |
467 | class TestURLParser(TestCase): |
468 | @@ -162,7 +161,7 @@ class TestProberHTTPSProtocolAndFactory(TestCase): |
469 | timeout=30) |
470 | |
471 | def setUp(self): |
472 | - super(TestProberHTTPSProtocolAndFactory, self).setUp() |
473 | + super().setUp() |
474 | root = DistributionMirrorTestSecureHTTPServer() |
475 | site = server.Site(root) |
476 | site.displayTracebacks = False |
477 | @@ -184,10 +183,10 @@ class TestProberHTTPSProtocolAndFactory(TestCase): |
478 | |
479 | self.port = self.listening_port.getHost().port |
480 | |
481 | - self.urls = {'timeout': u'https://localhost:%s/timeout' % self.port, |
482 | - '200': u'https://localhost:%s/valid-mirror' % self.port, |
483 | - '500': u'https://localhost:%s/error' % self.port, |
484 | - '404': u'https://localhost:%s/invalid-mirror' % self.port} |
485 | + self.urls = {'timeout': 'https://localhost:%s/timeout' % self.port, |
486 | + '200': 'https://localhost:%s/valid-mirror' % self.port, |
487 | + '500': 'https://localhost:%s/error' % self.port, |
488 | + '404': 'https://localhost:%s/invalid-mirror' % self.port} |
489 | self.pushConfig('launchpad', http_proxy=None) |
490 | |
491 | self.useFixture(MockPatchObject( |
492 | @@ -309,17 +308,17 @@ class TestProberProtocolAndFactory(TestCase): |
493 | timeout=30) |
494 | |
495 | def setUp(self): |
496 | - super(TestProberProtocolAndFactory, self).setUp() |
497 | + super().setUp() |
498 | root = DistributionMirrorTestHTTPServer() |
499 | site = server.Site(root) |
500 | site.displayTracebacks = False |
501 | self.listening_port = reactor.listenTCP(0, site) |
502 | self.addCleanup(self.listening_port.stopListening) |
503 | self.port = self.listening_port.getHost().port |
504 | - self.urls = {'timeout': u'http://localhost:%s/timeout' % self.port, |
505 | - '200': u'http://localhost:%s/valid-mirror' % self.port, |
506 | - '500': u'http://localhost:%s/error' % self.port, |
507 | - '404': u'http://localhost:%s/invalid-mirror' % self.port} |
508 | + self.urls = {'timeout': 'http://localhost:%s/timeout' % self.port, |
509 | + '200': 'http://localhost:%s/valid-mirror' % self.port, |
510 | + '500': 'http://localhost:%s/error' % self.port, |
511 | + '404': 'http://localhost:%s/invalid-mirror' % self.port} |
512 | self.pushConfig('launchpad', http_proxy=None) |
513 | |
514 | def _createProberAndProbe(self, url): |
515 | @@ -525,7 +524,7 @@ class TestProberFactoryRequestTimeoutRatioWithoutTwisted(TestCase): |
516 | host = 'foo.bar' |
517 | |
518 | def setUp(self): |
519 | - super(TestProberFactoryRequestTimeoutRatioWithoutTwisted, self).setUp() |
520 | + super().setUp() |
521 | self.orig_host_requests = dict( |
522 | distributionmirror_prober.host_requests) |
523 | self.orig_host_timeouts = dict( |
524 | @@ -537,9 +536,7 @@ class TestProberFactoryRequestTimeoutRatioWithoutTwisted(TestCase): |
525 | distributionmirror_prober.host_timeouts = self.orig_host_timeouts |
526 | # We need to remove any DelayedCalls that didn't actually get called. |
527 | clean_up_reactor() |
528 | - super( |
529 | - TestProberFactoryRequestTimeoutRatioWithoutTwisted, |
530 | - self).tearDown() |
531 | + super().tearDown() |
532 | |
533 | def _createProberStubConnectAndProbe(self, requests, timeouts): |
534 | """Create a ProberFactory object with a URL inside self.host and call |
535 | @@ -615,7 +612,7 @@ class TestProberFactoryRequestTimeoutRatioWithTwisted(TestCase): |
536 | run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=30) |
537 | |
538 | def setUp(self): |
539 | - super(TestProberFactoryRequestTimeoutRatioWithTwisted, self).setUp() |
540 | + super().setUp() |
541 | orig_host_requests = dict(distributionmirror_prober.host_requests) |
542 | orig_host_timeouts = dict(distributionmirror_prober.host_timeouts) |
543 | distributionmirror_prober.host_requests = {} |
544 | @@ -643,7 +640,7 @@ class TestProberFactoryRequestTimeoutRatioWithTwisted(TestCase): |
545 | def test_timeout_is_recorded(self): |
546 | host = 'localhost' |
547 | d = self._createProberAndProbe( |
548 | - u'http://%s:%s/timeout' % (host, self.port)) |
549 | + 'http://%s:%s/timeout' % (host, self.port)) |
550 | |
551 | def got_error(error): |
552 | self.assertEqual( |
553 | @@ -656,7 +653,7 @@ class TestProberFactoryRequestTimeoutRatioWithTwisted(TestCase): |
554 | def test_non_timeout_is_recorded(self): |
555 | host = 'localhost' |
556 | d = self._createProberAndProbe( |
557 | - u'http://%s:%s/valid-mirror' % (host, self.port)) |
558 | + 'http://%s:%s/valid-mirror' % (host, self.port)) |
559 | |
560 | def got_result(result): |
561 | self.assertEqual( |
562 | @@ -678,14 +675,14 @@ class TestProberFactoryRequestTimeoutRatioWithTwisted(TestCase): |
563 | self.assertTrue(should_skip_host(host)) |
564 | |
565 | d = self._createProberAndProbe( |
566 | - u'http://%s:%s/timeout' % (host, self.port)) |
567 | + 'http://%s:%s/timeout' % (host, self.port)) |
568 | return assert_fails_with(d, ConnectionSkipped) |
569 | |
570 | |
571 | class TestMultiLock(TestCase): |
572 | |
573 | def setUp(self): |
574 | - super(TestMultiLock, self).setUp() |
575 | + super().setUp() |
576 | self.lock_one = defer.DeferredLock() |
577 | self.lock_two = defer.DeferredLock() |
578 | self.multi_lock = MultiLock(self.lock_one, self.lock_two) |
579 | @@ -767,7 +764,7 @@ class TestRedirectAwareProberFactoryAndProtocol(TestCase): |
580 | def tearDown(self): |
581 | # We need to remove any DelayedCalls that didn't actually get called. |
582 | clean_up_reactor() |
583 | - super(TestRedirectAwareProberFactoryAndProtocol, self).tearDown() |
584 | + super().tearDown() |
585 | |
586 | def test_redirect_resets_timeout(self): |
587 | prober = RedirectAwareProberFactory('http://foo.bar') |
588 | @@ -1052,7 +1049,7 @@ class TestProbeFunctionSemaphores(TestCase): |
589 | layer = ZopelessDatabaseLayer |
590 | |
591 | def setUp(self): |
592 | - super(TestProbeFunctionSemaphores, self).setUp() |
593 | + super().setUp() |
594 | self.logger = None |
595 | # RequestManager uses a mutable class attribute (host_locks) to ensure |
596 | # all of its instances share the same locks. We don't want our tests |
597 | @@ -1063,7 +1060,7 @@ class TestProbeFunctionSemaphores(TestCase): |
598 | def tearDown(self): |
599 | # We need to remove any DelayedCalls that didn't actually get called. |
600 | clean_up_reactor() |
601 | - super(TestProbeFunctionSemaphores, self).tearDown() |
602 | + super().tearDown() |
603 | |
604 | def test_MirrorCDImageSeries_records_are_deleted_before_probing(self): |
605 | mirror = DistributionMirror.byName('releases-mirror2') |
606 | @@ -1162,7 +1159,7 @@ class TestLoggingMixin(TestCase): |
607 | def tearDown(self): |
608 | # We need to remove any DelayedCalls that didn't actually get called. |
609 | clean_up_reactor() |
610 | - super(TestLoggingMixin, self).tearDown() |
611 | + super().tearDown() |
612 | |
613 | def _fake_gettime(self): |
614 | # Fake the current time. |
615 | @@ -1194,7 +1191,7 @@ class TestDistroMirrorProberFunctional(TestCaseWithFactory): |
616 | layer = LaunchpadZopelessLayer |
617 | |
618 | def setUp(self): |
619 | - super(TestDistroMirrorProberFunctional, self).setUp() |
620 | + super().setUp() |
621 | # Makes a clean distro mirror set, with only the mirrors we want. |
622 | self.removeMirrors() |
623 | |
624 | diff --git a/lib/lp/registry/tests/test_distributionsourcepackage.py b/lib/lp/registry/tests/test_distributionsourcepackage.py |
625 | index df6052b..c9972dc 100644 |
626 | --- a/lib/lp/registry/tests/test_distributionsourcepackage.py |
627 | +++ b/lib/lp/registry/tests/test_distributionsourcepackage.py |
628 | @@ -188,7 +188,7 @@ class TestDistributionSourcePackageFindRelatedArchives(TestCaseWithFactory): |
629 | |
630 | def setUp(self): |
631 | """Publish some gedit sources in main and PPAs.""" |
632 | - super(TestDistributionSourcePackageFindRelatedArchives, self).setUp() |
633 | + super().setUp() |
634 | |
635 | self.distribution = getUtility(IDistributionSet)['ubuntutest'] |
636 | |
637 | diff --git a/lib/lp/registry/tests/test_distro_webservice.py b/lib/lp/registry/tests/test_distro_webservice.py |
638 | index f79e09e..32c60e0 100644 |
639 | --- a/lib/lp/registry/tests/test_distro_webservice.py |
640 | +++ b/lib/lp/registry/tests/test_distro_webservice.py |
641 | @@ -47,7 +47,7 @@ class TestGetBranchTips(TestCaseWithFactory): |
642 | layer = DatabaseFunctionalLayer |
643 | |
644 | def setUp(self): |
645 | - super(TestGetBranchTips, self).setUp() |
646 | + super().setUp() |
647 | self.distro = self.factory.makeDistribution() |
648 | series_1 = self.series_1 = self.factory.makeDistroSeries(self.distro) |
649 | series_2 = self.series_2 = self.factory.makeDistroSeries(self.distro) |
650 | diff --git a/lib/lp/registry/tests/test_distroseries.py b/lib/lp/registry/tests/test_distroseries.py |
651 | index d67e499..d214f99 100644 |
652 | --- a/lib/lp/registry/tests/test_distroseries.py |
653 | +++ b/lib/lp/registry/tests/test_distroseries.py |
654 | @@ -70,7 +70,7 @@ class CurrentSourceReleasesMixin: |
655 | """ |
656 | def setUp(self): |
657 | # Log in as an admin, so that we can create distributions. |
658 | - super(CurrentSourceReleasesMixin, self).setUp() |
659 | + super().setUp() |
660 | login('foo.bar@canonical.com') |
661 | self.publisher = SoyuzTestPublisher() |
662 | self.factory = self.publisher.factory |
663 | @@ -428,7 +428,7 @@ class TestDistroSeriesPackaging(TestCaseWithFactory): |
664 | layer = DatabaseFunctionalLayer |
665 | |
666 | def setUp(self): |
667 | - super(TestDistroSeriesPackaging, self).setUp() |
668 | + super().setUp() |
669 | self.series = self.factory.makeDistroSeries() |
670 | self.user = self.series.distribution.owner |
671 | login('admin@canonical.com') |
672 | @@ -523,7 +523,7 @@ class TestDistroSeriesPackaging(TestCaseWithFactory): |
673 | package_summaries = self.series.getPrioritizedUnlinkedSourcePackages() |
674 | names = [summary['package'].name for summary in package_summaries] |
675 | expected = [ |
676 | - u'main', u'hot-translatable', u'hot', u'translatable', u'normal'] |
677 | + 'main', 'hot-translatable', 'hot', 'translatable', 'normal'] |
678 | self.assertEqual(expected, names) |
679 | |
680 | def test_getPrioritizedUnlinkedSourcePackages_no_language_packs(self): |
681 | @@ -532,7 +532,7 @@ class TestDistroSeriesPackaging(TestCaseWithFactory): |
682 | package_summaries = self.series.getPrioritizedUnlinkedSourcePackages() |
683 | names = [summary['package'].name for summary in package_summaries] |
684 | expected = [ |
685 | - u'main', u'hot-translatable', u'hot', u'translatable', u'normal'] |
686 | + 'main', 'hot-translatable', 'hot', 'translatable', 'normal'] |
687 | self.assertEqual(expected, names) |
688 | |
689 | def test_getPrioritizedPackagings(self): |
690 | @@ -542,7 +542,7 @@ class TestDistroSeriesPackaging(TestCaseWithFactory): |
691 | packagings = self.series.getPrioritizedPackagings() |
692 | names = [packaging.sourcepackagename.name for packaging in packagings] |
693 | expected = [ |
694 | - u'main', u'hot-translatable', u'hot', u'translatable', u'linked'] |
695 | + 'main', 'hot-translatable', 'hot', 'translatable', 'linked'] |
696 | self.assertEqual(expected, names) |
697 | |
698 | def test_getPrioritizedPackagings_bug_tracker(self): |
699 | @@ -554,7 +554,7 @@ class TestDistroSeriesPackaging(TestCaseWithFactory): |
700 | product_series.product.bugtracker = self.factory.makeBugTracker() |
701 | packagings = self.series.getPrioritizedPackagings() |
702 | names = [packaging.sourcepackagename.name for packaging in packagings] |
703 | - expected = [u'hot', u'linked', u'cold'] |
704 | + expected = ['hot', 'linked', 'cold'] |
705 | self.assertEqual(expected, names) |
706 | |
707 | def test_getPrioritizedPackagings_branch(self): |
708 | @@ -566,7 +566,7 @@ class TestDistroSeriesPackaging(TestCaseWithFactory): |
709 | product_series.branch = self.factory.makeBranch() |
710 | packagings = self.series.getPrioritizedPackagings() |
711 | names = [packaging.sourcepackagename.name for packaging in packagings] |
712 | - expected = [u'translatable', u'linked', u'withbranch'] |
713 | + expected = ['translatable', 'linked', 'withbranch'] |
714 | self.assertEqual(expected, names) |
715 | |
716 | def test_getPrioritizedPackagings_translation(self): |
717 | @@ -581,7 +581,7 @@ class TestDistroSeriesPackaging(TestCaseWithFactory): |
718 | TranslationsBranchImportMode.IMPORT_TEMPLATES) |
719 | packagings = self.series.getPrioritizedPackagings() |
720 | names = [packaging.sourcepackagename.name for packaging in packagings] |
721 | - expected = [u'translatable', u'linked', u'importabletranslatable'] |
722 | + expected = ['translatable', 'linked', 'importabletranslatable'] |
723 | self.assertEqual(expected, names) |
724 | |
725 | def test_getSourcePackagePublishing_query_count(self): |
726 | @@ -687,7 +687,7 @@ class TestDistroSeriesSet(TestCaseWithFactory): |
727 | self.ref_translatables = self._get_translatables() |
728 | |
729 | new_distroseries = ( |
730 | - self.factory.makeDistroSeries(name=u"sampleseries")) |
731 | + self.factory.makeDistroSeries(name="sampleseries")) |
732 | with person_logged_in(new_distroseries.distribution.owner): |
733 | new_distroseries.hide_all_translations = False |
734 | transaction.commit() |
735 | @@ -705,11 +705,11 @@ class TestDistroSeriesSet(TestCaseWithFactory): |
736 | transaction.commit() |
737 | translatables = self._get_translatables() |
738 | self.assertEqual( |
739 | - translatables, self._ref_translatables(u"sampleseries"), |
740 | + translatables, self._ref_translatables("sampleseries"), |
741 | "After assigning a PO template, a distroseries should be " |
742 | "translatable but translatables() returns %r instead of %r." % ( |
743 | translatables, |
744 | - self._ref_translatables(u"sampleseries"))) |
745 | + self._ref_translatables("sampleseries"))) |
746 | |
747 | with person_logged_in(new_distroseries.distribution.owner): |
748 | new_distroseries.hide_all_translations = True |
749 | diff --git a/lib/lp/registry/tests/test_distroseries_vocabularies.py b/lib/lp/registry/tests/test_distroseries_vocabularies.py |
750 | index c5c30b8..8f7cc1b 100644 |
751 | --- a/lib/lp/registry/tests/test_distroseries_vocabularies.py |
752 | +++ b/lib/lp/registry/tests/test_distroseries_vocabularies.py |
753 | @@ -45,7 +45,7 @@ class TestDistroSeriesDerivationVocabulary(TestCaseWithFactory): |
754 | layer = DatabaseFunctionalLayer |
755 | |
756 | def setUp(self): |
757 | - super(TestDistroSeriesDerivationVocabulary, self).setUp() |
758 | + super().setUp() |
759 | self.all_distroseries = getUtility(IDistroSeriesSet).search() |
760 | self.all_series_with_arch = [ |
761 | series for series in self.all_distroseries |
762 | diff --git a/lib/lp/registry/tests/test_distroseriesdifference.py b/lib/lp/registry/tests/test_distroseriesdifference.py |
763 | index 18bb640..46dd5df 100644 |
764 | --- a/lib/lp/registry/tests/test_distroseriesdifference.py |
765 | +++ b/lib/lp/registry/tests/test_distroseriesdifference.py |
766 | @@ -863,7 +863,7 @@ class DistroSeriesDifferenceTestCase(TestCaseWithFactory): |
767 | # source_version with status PUBLISHED or PENDING. |
768 | dsp = self.factory.makeDistroSeriesParent() |
769 | source_package_name = self.factory.getOrMakeSourcePackageName('foo') |
770 | - versions = {'derived': u'1.2', 'parent': u'1.3'} |
771 | + versions = {'derived': '1.2', 'parent': '1.3'} |
772 | |
773 | ds_diff = self.factory.makeDistroSeriesDifference( |
774 | derived_series=dsp.derived_series, |
775 | @@ -1358,9 +1358,9 @@ class TestMostRecentPublications(TestCaseWithFactory): |
776 | # Create a new DistroSeriesDifference |
777 | version = self.factory.getUniqueInteger() |
778 | versions = { |
779 | - 'base': u'1.%d' % version, |
780 | - 'derived': u'1.%dderived1' % version, |
781 | - 'parent': u'1.%d-1' % version, |
782 | + 'base': '1.%d' % version, |
783 | + 'derived': '1.%dderived1' % version, |
784 | + 'parent': '1.%d-1' % version, |
785 | } |
786 | dsd = self.factory.makeDistroSeriesDifference( |
787 | derived_series=derived_series, |
788 | @@ -1427,7 +1427,7 @@ class TestMostRecentPublications(TestCaseWithFactory): |
789 | dsd = self.create_difference(derived_series) |
790 | # Modify the release version. |
791 | removeSecurityProxy( |
792 | - dsd.source_package_release.sourcepackagerelease).version += u"2" |
793 | + dsd.source_package_release.sourcepackagerelease).version += "2" |
794 | # Searching with match_version=False finds the publication. |
795 | self.assertContentEqual( |
796 | [(dsd.source_package_name.id, dsd.source_pub)], |
797 | diff --git a/lib/lp/registry/tests/test_initderiveddistroseries.py b/lib/lp/registry/tests/test_initderiveddistroseries.py |
798 | index ade4a6d..455135e 100644 |
799 | --- a/lib/lp/registry/tests/test_initderiveddistroseries.py |
800 | +++ b/lib/lp/registry/tests/test_initderiveddistroseries.py |
801 | @@ -34,7 +34,7 @@ class TestDeriveDistroSeries(TestCaseWithFactory): |
802 | layer = LaunchpadFunctionalLayer |
803 | |
804 | def setUp(self): |
805 | - super(TestDeriveDistroSeries, self).setUp() |
806 | + super().setUp() |
807 | self.parent = self.factory.makeDistroSeries() |
808 | arch = self.factory.makeDistroArchSeries(distroseries=self.parent) |
809 | removeSecurityProxy(self.parent).nominatedarchindep = arch |
810 | @@ -103,7 +103,7 @@ class TestDeriveDistroSeriesMultipleParents(InitializationHelperTestCase): |
811 | [parent1, parent2], child=child) |
812 | self.assertBinPackagesAndVersions( |
813 | child, |
814 | - [(u'p1', u'0.1-1'), (u'p2', u'2.1')]) |
815 | + [('p1', '0.1-1'), ('p2', '2.1')]) |
816 | |
817 | def test_multiple_parents_do_not_close_bugs(self): |
818 | # The initialization does not close the bugs on the copied |
819 | @@ -127,7 +127,7 @@ class TestDeriveDistroSeriesMultipleParents(InitializationHelperTestCase): |
820 | # Make sure the initialization was successful. |
821 | self.assertBinPackagesAndVersions( |
822 | child, |
823 | - [(u'p1', u'0.1-1'), (u'p2', u'2.1')]) |
824 | + [('p1', '0.1-1'), ('p2', '2.1')]) |
825 | # Assert that close_bugs_for_sourcepublication has not been |
826 | # called. |
827 | self.assertEqual( |
828 | @@ -143,10 +143,10 @@ class TestDeriveDistroSeriesMultipleParents(InitializationHelperTestCase): |
829 | parent, parent_das = self.setupParent() |
830 | # Create packageset p1 with a build. |
831 | p1, packageset1, unsed = self.createPackageInPackageset( |
832 | - parent, u'p1', u'packageset1', True) |
833 | + parent, 'p1', 'packageset1', True) |
834 | # Create packageset p2 without a build. |
835 | p2, packageset2, unsed = self.createPackageInPackageset( |
836 | - parent, u'p2', u'packageset2', False) |
837 | + parent, 'p2', 'packageset2', False) |
838 | child = self.factory.makeDistroSeries( |
839 | distribution=parent.distribution, previous_series=parent) |
840 | |
841 | diff --git a/lib/lp/registry/tests/test_listteammembers.py b/lib/lp/registry/tests/test_listteammembers.py |
842 | index f3e52e1..4f2e4ff 100644 |
843 | --- a/lib/lp/registry/tests/test_listteammembers.py |
844 | +++ b/lib/lp/registry/tests/test_listteammembers.py |
845 | @@ -7,52 +7,52 @@ from lp.testing.layers import LaunchpadZopelessLayer |
846 | |
847 | |
848 | ubuntuteam_default = sorted([ |
849 | - u'cprov, celso.providelo@canonical.com', |
850 | - u'edgar, edgar@monteparadiso.hr', |
851 | - u'jdub, jeff.waugh@ubuntulinux.com', |
852 | - u'kamion, colin.watson@ubuntulinux.com', |
853 | - u'kinnison, daniel.silverstone@canonical.com', |
854 | - u'limi, limi@plone.org', |
855 | - u'name16, foo.bar@canonical.com', |
856 | - u'mark, mark@example.com', |
857 | - u'stevea, steve.alexander@ubuntulinux.com', |
858 | - u'warty-gnome, --none--', |
859 | + 'cprov, celso.providelo@canonical.com', |
860 | + 'edgar, edgar@monteparadiso.hr', |
861 | + 'jdub, jeff.waugh@ubuntulinux.com', |
862 | + 'kamion, colin.watson@ubuntulinux.com', |
863 | + 'kinnison, daniel.silverstone@canonical.com', |
864 | + 'limi, limi@plone.org', |
865 | + 'name16, foo.bar@canonical.com', |
866 | + 'mark, mark@example.com', |
867 | + 'stevea, steve.alexander@ubuntulinux.com', |
868 | + 'warty-gnome, --none--', |
869 | ]) |
870 | |
871 | ubuntuteam_email = sorted([ |
872 | - u'admin@canonical.com', |
873 | - u'celso.providelo@canonical.com', |
874 | - u'colin.watson@ubuntulinux.com', |
875 | - u'cprov@ubuntu.com', |
876 | - u'daniel.silverstone@canonical.com', |
877 | - u'edgar@monteparadiso.hr', |
878 | - u'foo.bar@canonical.com', |
879 | - u'jeff.waugh@ubuntulinux.com', |
880 | - u'limi@plone.org', |
881 | - u'mark@example.com', |
882 | - u'steve.alexander@ubuntulinux.com', |
883 | + 'admin@canonical.com', |
884 | + 'celso.providelo@canonical.com', |
885 | + 'colin.watson@ubuntulinux.com', |
886 | + 'cprov@ubuntu.com', |
887 | + 'daniel.silverstone@canonical.com', |
888 | + 'edgar@monteparadiso.hr', |
889 | + 'foo.bar@canonical.com', |
890 | + 'jeff.waugh@ubuntulinux.com', |
891 | + 'limi@plone.org', |
892 | + 'mark@example.com', |
893 | + 'steve.alexander@ubuntulinux.com', |
894 | ]) |
895 | |
896 | ubuntuteam_full = sorted([ |
897 | - u'ubuntu-team|10|limi|limi@plone.org|Alexander Limi|no', |
898 | - u'ubuntu-team|11|stevea|steve.alexander@ubuntulinux.com' |
899 | - u'|Steve Alexander|no', |
900 | - u'ubuntu-team|16|name16|foo.bar@canonical.com|Foo Bar|yes', |
901 | - u'ubuntu-team|19|warty-gnome|--none--|Warty Gnome Team|no', |
902 | - u'ubuntu-team|1|mark|mark@example.com|Mark Shuttleworth|no', |
903 | - u'ubuntu-team|26|kinnison|daniel.silverstone@canonical.com' |
904 | - u'|Daniel Silverstone|no', |
905 | - u'ubuntu-team|28|cprov|celso.providelo@canonical.com|Celso Providelo|no', |
906 | - u'ubuntu-team|33|edgar|edgar@monteparadiso.hr|Edgar Bursic|no', |
907 | - u'ubuntu-team|4|kamion|colin.watson@ubuntulinux.com|Colin Watson|no', |
908 | - u'ubuntu-team|6|jdub|jeff.waugh@ubuntulinux.com|Jeff Waugh|no', |
909 | + 'ubuntu-team|10|limi|limi@plone.org|Alexander Limi|no', |
910 | + 'ubuntu-team|11|stevea|steve.alexander@ubuntulinux.com' |
911 | + '|Steve Alexander|no', |
912 | + 'ubuntu-team|16|name16|foo.bar@canonical.com|Foo Bar|yes', |
913 | + 'ubuntu-team|19|warty-gnome|--none--|Warty Gnome Team|no', |
914 | + 'ubuntu-team|1|mark|mark@example.com|Mark Shuttleworth|no', |
915 | + 'ubuntu-team|26|kinnison|daniel.silverstone@canonical.com' |
916 | + '|Daniel Silverstone|no', |
917 | + 'ubuntu-team|28|cprov|celso.providelo@canonical.com|Celso Providelo|no', |
918 | + 'ubuntu-team|33|edgar|edgar@monteparadiso.hr|Edgar Bursic|no', |
919 | + 'ubuntu-team|4|kamion|colin.watson@ubuntulinux.com|Colin Watson|no', |
920 | + 'ubuntu-team|6|jdub|jeff.waugh@ubuntulinux.com|Jeff Waugh|no', |
921 | ]) |
922 | |
923 | ubuntuteam_sshkeys = [ |
924 | - u'mark: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCeP6iOLFdRSJ/CwuUjj0dE3+bJi' |
925 | - u'ZUn2AsappUcjCZN75CBKvqPkpGDIU/ZlOddAdj1rif6dl9rqEBuoliduIZ1bmPaGs1jmpME' |
926 | - u'7HPctLhCmzy1oC8wkdVNkZnmoTW34j5Y8mKWuy32hVWvp3OdfIo+dxW576ny52VkTbST+t4' |
927 | - u'KlQ== Private key in lib/lp/codehosting/tests/id_rsa', |
928 | + 'mark: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCeP6iOLFdRSJ/CwuUjj0dE3+bJi' |
929 | + 'ZUn2AsappUcjCZN75CBKvqPkpGDIU/ZlOddAdj1rif6dl9rqEBuoliduIZ1bmPaGs1jmpME' |
930 | + '7HPctLhCmzy1oC8wkdVNkZnmoTW34j5Y8mKWuy32hVWvp3OdfIo+dxW576ny52VkTbST+t4' |
931 | + 'KlQ== Private key in lib/lp/codehosting/tests/id_rsa', |
932 | ] |
933 | |
934 | |
935 | @@ -89,11 +89,11 @@ class ListTeamMembersTestCase(TestCaseWithFactory): |
936 | team = self.factory.makeTeam(name='squadron') |
937 | team.addMember(member, reviewer=team.teamowner) |
938 | sshkey = self.factory.makeSSHKey(member) |
939 | - sshkey.keytext = u'123badKeysMight\r\nContain\fBadCharacters' |
940 | + sshkey.keytext = '123badKeysMight\r\nContain\fBadCharacters' |
941 | sshkey.comment = 'co\rmm\ne\f\fnt' |
942 | expected = dict( |
943 | - name=u'biggles', |
944 | - sshkey=u'ssh-rsa 123badKeysMightContainBadCharacters comment') |
945 | + name='biggles', |
946 | + sshkey='ssh-rsa 123badKeysMightContainBadCharacters comment') |
947 | result = listteammembers.make_sshkey_params(member, sshkey) |
948 | self.assertEqual(expected, result) |
949 | |
950 | diff --git a/lib/lp/registry/tests/test_mailinglist.py b/lib/lp/registry/tests/test_mailinglist.py |
951 | index c57c57f..de70d1e 100644 |
952 | --- a/lib/lp/registry/tests/test_mailinglist.py |
953 | +++ b/lib/lp/registry/tests/test_mailinglist.py |
954 | @@ -453,7 +453,7 @@ class MailingListSetTestCase(TestCaseWithFactory): |
955 | layer = DatabaseFunctionalLayer |
956 | |
957 | def setUp(self): |
958 | - super(MailingListSetTestCase, self).setUp() |
959 | + super().setUp() |
960 | self.mailing_list_set = getUtility(IMailingListSet) |
961 | login_celebrity('admin') |
962 | |
963 | @@ -717,7 +717,7 @@ class MailingListMessageTestCase(TestCaseWithFactory): |
964 | layer = LaunchpadFunctionalLayer |
965 | |
966 | def setUp(self): |
967 | - super(MailingListMessageTestCase, self).setUp() |
968 | + super().setUp() |
969 | self.mailing_list_set = getUtility(IMailingListSet) |
970 | login_celebrity('admin') |
971 | |
972 | diff --git a/lib/lp/registry/tests/test_mailinglistapi.py b/lib/lp/registry/tests/test_mailinglistapi.py |
973 | index c7ea028..c992116 100644 |
974 | --- a/lib/lp/registry/tests/test_mailinglistapi.py |
975 | +++ b/lib/lp/registry/tests/test_mailinglistapi.py |
976 | @@ -63,7 +63,7 @@ class MailingListAPITestCase(TestCaseWithFactory): |
977 | |
978 | def setUp(self): |
979 | """Create a team with a list and subscribe self.member to it.""" |
980 | - super(MailingListAPITestCase, self).setUp() |
981 | + super().setUp() |
982 | self.team, self.mailing_list = new_team('team-a', with_list=True) |
983 | self.member = self.factory.makePersonByName('Bob') |
984 | with person_logged_in(self.member): |
985 | @@ -73,8 +73,8 @@ class MailingListAPITestCase(TestCaseWithFactory): |
986 | self.team_expected = sorted([ |
987 | (config.mailman.archive_address, '', 0, ENABLED), |
988 | ('bob.person@example.com', 'Bob Person', 0, ENABLED), |
989 | - ('bperson@example.org', u'Bob Person', 0, BYUSER), |
990 | - ('no-priv@canonical.com', u'No Privileges Person', 0, BYUSER), |
991 | + ('bperson@example.org', 'Bob Person', 0, BYUSER), |
992 | + ('no-priv@canonical.com', 'No Privileges Person', 0, BYUSER), |
993 | ]) |
994 | |
995 | def test_getMembershipInformation(self): |
996 | @@ -256,7 +256,7 @@ class MailingListAPIWorkflowTestCase(TestCaseWithFactory): |
997 | layer = DatabaseFunctionalLayer |
998 | |
999 | def setUp(self): |
1000 | - super(MailingListAPIWorkflowTestCase, self).setUp() |
1001 | + super().setUp() |
1002 | self.mailinglist_api = MailingListAPIView(None, None) |
1003 | self.mailinglist_set = getUtility(IMailingListSet) |
1004 | |
1005 | @@ -274,8 +274,8 @@ class MailingListAPIWorkflowTestCase(TestCaseWithFactory): |
1006 | self.mailinglist_set.new(team_b, team_b.teamowner) |
1007 | self.assertEqual( |
1008 | {'create': [ |
1009 | - (u'team-a', {}), |
1010 | - (u'team-b', {})]}, |
1011 | + ('team-a', {}), |
1012 | + ('team-b', {})]}, |
1013 | self.mailinglist_api.getPendingActions()) |
1014 | |
1015 | def test_getPendingActions_constructing(self): |
1016 | @@ -284,7 +284,7 @@ class MailingListAPIWorkflowTestCase(TestCaseWithFactory): |
1017 | team_list = self.mailinglist_set.new(team, team.teamowner) |
1018 | self.assertEqual(MailingListStatus.APPROVED, team_list.status) |
1019 | actions = self.mailinglist_api.getPendingActions() |
1020 | - self.assertEqual({'create': [(u'team', {})]}, actions) |
1021 | + self.assertEqual({'create': [('team', {})]}, actions) |
1022 | self.assertEqual(MailingListStatus.CONSTRUCTING, team_list.status) |
1023 | |
1024 | def test_reportStatus_constructing_success(self): |
1025 | @@ -311,7 +311,7 @@ class MailingListAPIWorkflowTestCase(TestCaseWithFactory): |
1026 | actions = self.mailinglist_api.getPendingActions() |
1027 | actions = self.mailinglist_api.getPendingActions() |
1028 | self.assertEqual( |
1029 | - {'unsynchronized': [(u'team', 'constructing')]}, actions) |
1030 | + {'unsynchronized': [('team', 'constructing')]}, actions) |
1031 | self.assertEqual(MailingListStatus.CONSTRUCTING, team_list.status) |
1032 | |
1033 | def test_getPendingActions_deactivating(self): |
1034 | @@ -322,7 +322,7 @@ class MailingListAPIWorkflowTestCase(TestCaseWithFactory): |
1035 | team_list.deactivate() |
1036 | self.assertEqual(MailingListStatus.DEACTIVATING, team_list.status) |
1037 | actions = self.mailinglist_api.getPendingActions() |
1038 | - self.assertEqual({'deactivate': [u'team']}, actions) |
1039 | + self.assertEqual({'deactivate': ['team']}, actions) |
1040 | self.assertEqual(MailingListStatus.DEACTIVATING, team_list.status) |
1041 | |
1042 | def test_reportStatus_deactivating_success(self): |
1043 | @@ -354,7 +354,7 @@ class MailingListAPIWorkflowTestCase(TestCaseWithFactory): |
1044 | self.assertEqual(MailingListStatus.MODIFIED, team_list.status) |
1045 | actions = self.mailinglist_api.getPendingActions() |
1046 | self.assertEqual( |
1047 | - {'modify': [(u'team', {'welcome_message': u'hi'})]}, actions) |
1048 | + {'modify': [('team', {'welcome_message': 'hi'})]}, actions) |
1049 | self.assertEqual(MailingListStatus.UPDATING, team_list.status) |
1050 | |
1051 | def test_reportStatus_modifying_success(self): |
1052 | @@ -426,7 +426,7 @@ class MailingListAPIMessageTestCase(TestCaseWithFactory): |
1053 | layer = LaunchpadFunctionalLayer |
1054 | |
1055 | def setUp(self): |
1056 | - super(MailingListAPIMessageTestCase, self).setUp() |
1057 | + super().setUp() |
1058 | self.mailinglist_api = MailingListAPIView(None, None) |
1059 | self.mailinglist_set = getUtility(IMailingListSet) |
1060 | self.message_set = getUtility(IMessageSet) |
1061 | @@ -526,7 +526,7 @@ class MailingListAPIMessageTestCase(TestCaseWithFactory): |
1062 | found.approve(team.teamowner) |
1063 | self.assertEqual(PostedMessageStatus.APPROVAL_PENDING, found.status) |
1064 | self.assertEqual( |
1065 | - {u'<first-post>': (u'team', 'accept')}, |
1066 | + {'<first-post>': ('team', 'accept')}, |
1067 | self.mailinglist_api.getMessageDispositions()) |
1068 | self.assertEqual(PostedMessageStatus.APPROVED, found.status) |
1069 | |
1070 | @@ -539,7 +539,7 @@ class MailingListAPIMessageTestCase(TestCaseWithFactory): |
1071 | found.reject(team.teamowner) |
1072 | self.assertEqual(PostedMessageStatus.REJECTION_PENDING, found.status) |
1073 | self.assertEqual( |
1074 | - {u'<first-post>': (u'team', 'decline')}, |
1075 | + {'<first-post>': ('team', 'decline')}, |
1076 | self.mailinglist_api.getMessageDispositions()) |
1077 | self.assertEqual(PostedMessageStatus.REJECTED, found.status) |
1078 | |
1079 | @@ -552,6 +552,6 @@ class MailingListAPIMessageTestCase(TestCaseWithFactory): |
1080 | found.discard(team.teamowner) |
1081 | self.assertEqual(PostedMessageStatus.DISCARD_PENDING, found.status) |
1082 | self.assertEqual( |
1083 | - {u'<first-post>': (u'team', 'discard')}, |
1084 | + {'<first-post>': ('team', 'discard')}, |
1085 | self.mailinglist_api.getMessageDispositions()) |
1086 | self.assertEqual(PostedMessageStatus.DISCARDED, found.status) |
1087 | diff --git a/lib/lp/registry/tests/test_membership_notification_job.py b/lib/lp/registry/tests/test_membership_notification_job.py |
1088 | index 3d4ca21..c7337cd 100644 |
1089 | --- a/lib/lp/registry/tests/test_membership_notification_job.py |
1090 | +++ b/lib/lp/registry/tests/test_membership_notification_job.py |
1091 | @@ -40,7 +40,7 @@ class MembershipNotificationJobTest(TestCaseWithFactory): |
1092 | layer = DatabaseFunctionalLayer |
1093 | |
1094 | def setUp(self): |
1095 | - super(MembershipNotificationJobTest, self).setUp() |
1096 | + super().setUp() |
1097 | self.person = self.factory.makePerson(name='murdock') |
1098 | self.team = self.factory.makeTeam(name='a-team') |
1099 | self.job_source = getUtility(IMembershipNotificationJobSource) |
1100 | diff --git a/lib/lp/registry/tests/test_milestone.py b/lib/lp/registry/tests/test_milestone.py |
1101 | index f20894c..884e826 100644 |
1102 | --- a/lib/lp/registry/tests/test_milestone.py |
1103 | +++ b/lib/lp/registry/tests/test_milestone.py |
1104 | @@ -118,7 +118,7 @@ class MilestoneSecurityAdaperTestCase(TestCaseWithFactory): |
1105 | layer = DatabaseFunctionalLayer |
1106 | |
1107 | def setUp(self): |
1108 | - super(MilestoneSecurityAdaperTestCase, self).setUp() |
1109 | + super().setUp() |
1110 | self.public_product = self.factory.makeProduct() |
1111 | self.public_milestone = self.factory.makeMilestone( |
1112 | product=self.public_product) |
1113 | @@ -453,7 +453,7 @@ class MilestoneBugTaskSpecificationTest(TestCaseWithFactory): |
1114 | layer = DatabaseFunctionalLayer |
1115 | |
1116 | def setUp(self): |
1117 | - super(MilestoneBugTaskSpecificationTest, self).setUp() |
1118 | + super().setUp() |
1119 | self.owner = self.factory.makePerson() |
1120 | self.product = self.factory.makeProduct(name="product1") |
1121 | self.milestone = self.factory.makeMilestone(product=self.product) |
1122 | @@ -618,7 +618,7 @@ class ProjectMilestoneSecurityAdaperTestCase(TestCaseWithFactory): |
1123 | layer = DatabaseFunctionalLayer |
1124 | |
1125 | def setUp(self): |
1126 | - super(ProjectMilestoneSecurityAdaperTestCase, self).setUp() |
1127 | + super().setUp() |
1128 | project_group = self.factory.makeProject() |
1129 | public_product = self.factory.makeProduct(projectgroup=project_group) |
1130 | self.factory.makeMilestone( |
1131 | diff --git a/lib/lp/registry/tests/test_milestone_vocabularies.py b/lib/lp/registry/tests/test_milestone_vocabularies.py |
1132 | index 0cae9eb..e8f4ad9 100644 |
1133 | --- a/lib/lp/registry/tests/test_milestone_vocabularies.py |
1134 | +++ b/lib/lp/registry/tests/test_milestone_vocabularies.py |
1135 | @@ -55,7 +55,7 @@ class TestMilestoneVocabulary(TestCaseWithFactory): |
1136 | firefox = getUtility(IProductSet).getByName('firefox') |
1137 | vocabulary = MilestoneVocabulary(firefox) |
1138 | self.assertEqual( |
1139 | - [term.title for term in vocabulary], [u'Mozilla Firefox 1.0']) |
1140 | + [term.title for term in vocabulary], ['Mozilla Firefox 1.0']) |
1141 | |
1142 | def testProductSeriesMilestoneVocabulary(self): |
1143 | """Test of MilestoneVocabulary for a product series.""" |
1144 | @@ -63,14 +63,14 @@ class TestMilestoneVocabulary(TestCaseWithFactory): |
1145 | trunk = firefox.getSeries('trunk') |
1146 | vocabulary = MilestoneVocabulary(trunk) |
1147 | self.assertEqual( |
1148 | - [term.title for term in vocabulary], [u'Mozilla Firefox 1.0']) |
1149 | + [term.title for term in vocabulary], ['Mozilla Firefox 1.0']) |
1150 | |
1151 | def testProjectGroupMilestoneVocabulary(self): |
1152 | """Test of MilestoneVocabulary for a project group.""" |
1153 | mozilla = getUtility(IProjectGroupSet).getByName('mozilla') |
1154 | vocabulary = MilestoneVocabulary(mozilla) |
1155 | self.assertEqual( |
1156 | - [term.title for term in vocabulary], [u'Mozilla Firefox 1.0']) |
1157 | + [term.title for term in vocabulary], ['Mozilla Firefox 1.0']) |
1158 | |
1159 | def testDistributionMilestoneVocabulary(self): |
1160 | """Test of MilestoneVocabulary for a distribution.""" |
1161 | @@ -78,7 +78,7 @@ class TestMilestoneVocabulary(TestCaseWithFactory): |
1162 | vocabulary = MilestoneVocabulary(debian) |
1163 | self.assertEqual( |
1164 | [term.title for term in vocabulary], |
1165 | - [u'Debian 3.1', u'Debian 3.1-rc1']) |
1166 | + ['Debian 3.1', 'Debian 3.1-rc1']) |
1167 | |
1168 | def testDistroseriesMilestoneVocabulary(self): |
1169 | """Test of MilestoneVocabulary for a distroseries.""" |
1170 | @@ -87,7 +87,7 @@ class TestMilestoneVocabulary(TestCaseWithFactory): |
1171 | vocabulary = MilestoneVocabulary(woody) |
1172 | self.assertEqual( |
1173 | [term.title for term in vocabulary], |
1174 | - [u'Debian 3.1', u'Debian 3.1-rc1']) |
1175 | + ['Debian 3.1', 'Debian 3.1-rc1']) |
1176 | |
1177 | def testSpecificationMilestoneVocabulary(self): |
1178 | """Test of MilestoneVocabulary for a specification.""" |
1179 | @@ -96,7 +96,7 @@ class TestMilestoneVocabulary(TestCaseWithFactory): |
1180 | self.assertEqual(spec.target, firefox) |
1181 | vocabulary = MilestoneVocabulary(spec) |
1182 | self.assertEqual( |
1183 | - [term.title for term in vocabulary], [u'Mozilla Firefox 1.0']) |
1184 | + [term.title for term in vocabulary], ['Mozilla Firefox 1.0']) |
1185 | |
1186 | def testPersonMilestoneVocabulary(self): |
1187 | """Test of MilestoneVocabulary for a person.""" |
1188 | @@ -107,7 +107,7 @@ class TestMilestoneVocabulary(TestCaseWithFactory): |
1189 | # in such a case of all known visible milestones. |
1190 | self.assertEqual( |
1191 | [term.title for term in vocabulary], |
1192 | - [u'Debian 3.1', u'Debian 3.1-rc1', u'Mozilla Firefox 1.0']) |
1193 | + ['Debian 3.1', 'Debian 3.1-rc1', 'Mozilla Firefox 1.0']) |
1194 | |
1195 | |
1196 | class TestMilestoneWithDateExpectedVocabulary(TestCaseWithFactory): |
1197 | @@ -119,7 +119,7 @@ class TestMilestoneWithDateExpectedVocabulary(TestCaseWithFactory): |
1198 | vocabulary = MilestoneWithDateExpectedVocabulary(firefox) |
1199 | self.assertEqual( |
1200 | [term.title for term in vocabulary], |
1201 | - [u'Mozilla Firefox 1.0 (2056-10-16)']) |
1202 | + ['Mozilla Firefox 1.0 (2056-10-16)']) |
1203 | |
1204 | def test_milestone_without_date_expected(self): |
1205 | evolution = getUtility(IProductSet).getByName('evolution') |
1206 | diff --git a/lib/lp/registry/tests/test_milestonetag.py b/lib/lp/registry/tests/test_milestonetag.py |
1207 | index 0713fe4..10ff914 100644 |
1208 | --- a/lib/lp/registry/tests/test_milestonetag.py |
1209 | +++ b/lib/lp/registry/tests/test_milestonetag.py |
1210 | @@ -29,10 +29,10 @@ class MilestoneTagTest(TestCaseWithFactory): |
1211 | layer = DatabaseFunctionalLayer |
1212 | |
1213 | def setUp(self): |
1214 | - super(MilestoneTagTest, self).setUp() |
1215 | + super().setUp() |
1216 | self.milestone = self.factory.makeMilestone() |
1217 | self.person = self.milestone.target.owner |
1218 | - self.tags = [u'tag2', u'tag1', u'tag3'] |
1219 | + self.tags = ['tag2', 'tag1', 'tag3'] |
1220 | |
1221 | def test_no_tags(self): |
1222 | # Ensure a newly created milestone does not have associated tags. |
1223 | @@ -48,7 +48,7 @@ class MilestoneTagTest(TestCaseWithFactory): |
1224 | # Ensure you can override tags already associated with the milestone. |
1225 | with person_logged_in(self.person): |
1226 | self.milestone.setTags(self.tags, self.person) |
1227 | - new_tags = [u'tag2', u'tag4', u'tag3'] |
1228 | + new_tags = ['tag2', 'tag4', 'tag3'] |
1229 | self.milestone.setTags(new_tags, self.person) |
1230 | self.assertEqual(sorted(new_tags), self.milestone.getTags()) |
1231 | |
1232 | @@ -61,7 +61,7 @@ class MilestoneTagTest(TestCaseWithFactory): |
1233 | |
1234 | def test_user_metadata(self): |
1235 | # Ensure the correct user metadata is created when tags are added. |
1236 | - tag = u'tag1' |
1237 | + tag = 'tag1' |
1238 | with person_logged_in(self.person): |
1239 | self.milestone.setTags([tag], self.person) |
1240 | values = self.milestone.getTagsData().values( |
1241 | @@ -78,7 +78,7 @@ class MilestoneTagTest(TestCaseWithFactory): |
1242 | new_person = self.factory.makePerson() |
1243 | with person_logged_in(self.person): |
1244 | self.milestone.setTags(self.tags, self.person) |
1245 | - new_tags = [u'tag2', u'tag4', u'tag3'] |
1246 | + new_tags = ['tag2', 'tag4', 'tag3'] |
1247 | self.milestone.setTags(new_tags, new_person) |
1248 | values = self.milestone.getTagsData().values( |
1249 | MilestoneTag.tag, |
1250 | @@ -99,7 +99,7 @@ class ProjectGroupMilestoneTagTest(TestCaseWithFactory): |
1251 | layer = DatabaseFunctionalLayer |
1252 | |
1253 | def setUp(self): |
1254 | - super(ProjectGroupMilestoneTagTest, self).setUp() |
1255 | + super().setUp() |
1256 | self.owner = self.factory.makePerson() |
1257 | self.project_group = self.factory.makeProject(owner=self.owner) |
1258 | self.product = self.factory.makeProduct( |
1259 | @@ -131,7 +131,7 @@ class ProjectGroupMilestoneTagTest(TestCaseWithFactory): |
1260 | specifications.append(specification) |
1261 | return specifications |
1262 | |
1263 | - def _create_items_for_retrieval(self, factory, tag=u'tag1'): |
1264 | + def _create_items_for_retrieval(self, factory, tag='tag1'): |
1265 | with person_logged_in(self.owner): |
1266 | self.milestone.setTags([tag], self.owner) |
1267 | items = factory(5, self.milestone) |
1268 | @@ -139,7 +139,7 @@ class ProjectGroupMilestoneTagTest(TestCaseWithFactory): |
1269 | target=self.project_group, tags=[tag]) |
1270 | return items, milestonetag |
1271 | |
1272 | - def _create_items_for_untagged_milestone(self, factory, tag=u'tag1'): |
1273 | + def _create_items_for_untagged_milestone(self, factory, tag='tag1'): |
1274 | new_milestone = self.factory.makeMilestone(product=self.product) |
1275 | with person_logged_in(self.owner): |
1276 | self.milestone.setTags([tag], self.owner) |
1277 | @@ -150,7 +150,7 @@ class ProjectGroupMilestoneTagTest(TestCaseWithFactory): |
1278 | return items, milestonetag |
1279 | |
1280 | def _create_items_for_multiple_tags( |
1281 | - self, factory, tags=(u'tag1', u'tag2')): |
1282 | + self, factory, tags=('tag1', 'tag2')): |
1283 | new_milestone = self.factory.makeMilestone(product=self.product) |
1284 | with person_logged_in(self.owner): |
1285 | self.milestone.setTags(tags, self.owner) |
1286 | @@ -211,7 +211,7 @@ class MilestoneTagWebServiceTest(WebServiceTestCase): |
1287 | layer = AppServerLayer |
1288 | |
1289 | def setUp(self): |
1290 | - super(MilestoneTagWebServiceTest, self).setUp() |
1291 | + super().setUp() |
1292 | self.owner = self.factory.makePerson() |
1293 | self.product = self.factory.makeProduct(owner=self.owner) |
1294 | self.milestone = self.factory.makeMilestone(product=self.product) |
1295 | @@ -222,22 +222,22 @@ class MilestoneTagWebServiceTest(WebServiceTestCase): |
1296 | self.assertEqual([], self.ws_milestone.getTags()) |
1297 | |
1298 | def test_get_tags(self): |
1299 | - tags = [u'zeta', u'alpha', u'beta'] |
1300 | + tags = ['zeta', 'alpha', 'beta'] |
1301 | self.milestone.setTags(tags, self.owner) |
1302 | transaction.commit() |
1303 | self.assertEqual(sorted(tags), self.ws_milestone.getTags()) |
1304 | |
1305 | def test_set_tags_initial(self): |
1306 | - tags = [u'zeta', u'alpha', u'beta'] |
1307 | + tags = ['zeta', 'alpha', 'beta'] |
1308 | self.ws_milestone.setTags(tags=tags) |
1309 | self.ws_milestone.lp_save() |
1310 | transaction.begin() |
1311 | self.assertEqual(sorted(tags), self.milestone.getTags()) |
1312 | |
1313 | def test_set_tags_replace(self): |
1314 | - tags1 = [u'zeta', u'alpha', u'beta'] |
1315 | + tags1 = ['zeta', 'alpha', 'beta'] |
1316 | self.milestone.setTags(tags1, self.owner) |
1317 | - tags2 = [u'delta', u'alpha', u'gamma'] |
1318 | + tags2 = ['delta', 'alpha', 'gamma'] |
1319 | self.ws_milestone.setTags(tags=tags2) |
1320 | self.ws_milestone.lp_save() |
1321 | transaction.begin() |
1322 | @@ -245,4 +245,4 @@ class MilestoneTagWebServiceTest(WebServiceTestCase): |
1323 | |
1324 | def test_set_tags_invalid(self): |
1325 | self.assertRaises( |
1326 | - BadRequest, self.ws_milestone.setTags, tags=[u'&%&%^&']) |
1327 | + BadRequest, self.ws_milestone.setTags, tags=['&%&%^&']) |
1328 | diff --git a/lib/lp/registry/tests/test_mlists.py b/lib/lp/registry/tests/test_mlists.py |
1329 | index eedcfa2..ac751d5 100644 |
1330 | --- a/lib/lp/registry/tests/test_mlists.py |
1331 | +++ b/lib/lp/registry/tests/test_mlists.py |
1332 | @@ -88,7 +88,7 @@ class BaseMailingListImportTest(unittest.TestCase): |
1333 | members = {person.name for person in self.team.allmembers} |
1334 | expected = set(people) |
1335 | # Always add the team owner. |
1336 | - expected.add(u'teamowner') |
1337 | + expected.add('teamowner') |
1338 | self.assertEqual(members, expected) |
1339 | |
1340 | def assertAddresses(self, *addresses): |
1341 | @@ -117,11 +117,11 @@ class TestMailingListImports(BaseMailingListImportTest): |
1342 | 'dperson@example.org', |
1343 | 'elly.person@example.com', |
1344 | )) |
1345 | - self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly') |
1346 | + self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly') |
1347 | self.assertAddresses( |
1348 | - u'anne.person@example.com', u'bperson@example.org', |
1349 | - u'cris.person@example.com', u'dperson@example.org', |
1350 | - u'elly.person@example.com') |
1351 | + 'anne.person@example.com', 'bperson@example.org', |
1352 | + 'cris.person@example.com', 'dperson@example.org', |
1353 | + 'elly.person@example.com') |
1354 | |
1355 | def test_extended_import_membership(self): |
1356 | # Test the import of a list/team membership, where all email |
1357 | @@ -134,11 +134,11 @@ class TestMailingListImports(BaseMailingListImportTest): |
1358 | 'dperson@example.org', |
1359 | 'elly.person@example.com (Elly Q. Person)', |
1360 | )) |
1361 | - self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly') |
1362 | + self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly') |
1363 | self.assertAddresses( |
1364 | - u'anne.person@example.com', u'bperson@example.org', |
1365 | - u'cris.person@example.com', u'dperson@example.org', |
1366 | - u'elly.person@example.com') |
1367 | + 'anne.person@example.com', 'bperson@example.org', |
1368 | + 'cris.person@example.com', 'dperson@example.org', |
1369 | + 'elly.person@example.com') |
1370 | |
1371 | def test_import_with_non_persons(self): |
1372 | # Test the import of a list/team membership where not all the |
1373 | @@ -155,11 +155,11 @@ class TestMailingListImports(BaseMailingListImportTest): |
1374 | 'gwen.person@example.com', |
1375 | 'hperson@example.org', |
1376 | )) |
1377 | - self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly') |
1378 | + self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly') |
1379 | self.assertAddresses( |
1380 | - u'anne.person@example.com', u'bperson@example.org', |
1381 | - u'cris.person@example.com', u'dperson@example.org', |
1382 | - u'elly.person@example.com') |
1383 | + 'anne.person@example.com', 'bperson@example.org', |
1384 | + 'cris.person@example.com', 'dperson@example.org', |
1385 | + 'elly.person@example.com') |
1386 | |
1387 | def test_import_with_invalid_emails(self): |
1388 | # Test the import of a list/team membership where all the |
1389 | @@ -177,10 +177,10 @@ class TestMailingListImports(BaseMailingListImportTest): |
1390 | 'dperson@example.org', |
1391 | 'elly.person@example.com', |
1392 | )) |
1393 | - self.assertPeople(u'bart', u'cris', u'dave', u'elly') |
1394 | + self.assertPeople('bart', 'cris', 'dave', 'elly') |
1395 | self.assertAddresses( |
1396 | - u'bperson@example.org', u'cris.person@example.com', |
1397 | - u'dperson@example.org', u'elly.person@example.com') |
1398 | + 'bperson@example.org', 'cris.person@example.com', |
1399 | + 'dperson@example.org', 'elly.person@example.com') |
1400 | |
1401 | def test_already_joined(self): |
1402 | # Test import when a user is already joined to the team, but |
1403 | @@ -194,11 +194,11 @@ class TestMailingListImports(BaseMailingListImportTest): |
1404 | 'dperson@example.org', |
1405 | 'elly.person@example.com', |
1406 | )) |
1407 | - self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly') |
1408 | + self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly') |
1409 | self.assertAddresses( |
1410 | - u'anne.person@example.com', u'bperson@example.org', |
1411 | - u'cris.person@example.com', u'dperson@example.org', |
1412 | - u'elly.person@example.com') |
1413 | + 'anne.person@example.com', 'bperson@example.org', |
1414 | + 'cris.person@example.com', 'dperson@example.org', |
1415 | + 'elly.person@example.com') |
1416 | |
1417 | def test_already_subscribed(self): |
1418 | # Test import when a user is already joined to the team, and |
1419 | @@ -213,11 +213,11 @@ class TestMailingListImports(BaseMailingListImportTest): |
1420 | 'dperson@example.org', |
1421 | 'elly.person@example.com', |
1422 | )) |
1423 | - self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly') |
1424 | + self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly') |
1425 | self.assertAddresses( |
1426 | - u'anne.person@example.com', u'bperson@example.org', |
1427 | - u'cris.person@example.com', u'dperson@example.org', |
1428 | - u'elly.person@example.com') |
1429 | + 'anne.person@example.com', 'bperson@example.org', |
1430 | + 'cris.person@example.com', 'dperson@example.org', |
1431 | + 'elly.person@example.com') |
1432 | |
1433 | def test_import_from_file(self): |
1434 | # Test importing addresses from a file. |
1435 | @@ -230,11 +230,11 @@ class TestMailingListImports(BaseMailingListImportTest): |
1436 | 'Elly Q. Person <eperson@example.org', |
1437 | ) |
1438 | importer.importFromFile(self.filename) |
1439 | - self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly') |
1440 | + self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly') |
1441 | self.assertAddresses( |
1442 | - u'anne.person@example.com', u'bart.person@example.com', |
1443 | - u'cperson@example.org', u'dperson@example.org', |
1444 | - u'eperson@example.org') |
1445 | + 'anne.person@example.com', 'bart.person@example.com', |
1446 | + 'cperson@example.org', 'dperson@example.org', |
1447 | + 'eperson@example.org') |
1448 | |
1449 | def test_import_from_file_with_non_persons(self): |
1450 | # Test the import of a list/team membership from a file where |
1451 | @@ -254,11 +254,11 @@ class TestMailingListImports(BaseMailingListImportTest): |
1452 | 'iris.person@example.com', |
1453 | ) |
1454 | importer.importFromFile(self.filename) |
1455 | - self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly') |
1456 | + self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly') |
1457 | self.assertAddresses( |
1458 | - u'anne.person@example.com', u'bart.person@example.com', |
1459 | - u'cperson@example.org', u'dperson@example.org', |
1460 | - u'eperson@example.org') |
1461 | + 'anne.person@example.com', 'bart.person@example.com', |
1462 | + 'cperson@example.org', 'dperson@example.org', |
1463 | + 'eperson@example.org') |
1464 | |
1465 | def test_import_from_file_with_invalid_emails(self): |
1466 | # Test importing addresses from a file with invalid emails. |
1467 | @@ -274,10 +274,10 @@ class TestMailingListImports(BaseMailingListImportTest): |
1468 | 'Elly Q. Person <eperson@example.org', |
1469 | ) |
1470 | importer.importFromFile(self.filename) |
1471 | - self.assertPeople(u'bart', u'cris', u'dave', u'elly') |
1472 | + self.assertPeople('bart', 'cris', 'dave', 'elly') |
1473 | self.assertAddresses( |
1474 | - u'bart.person@example.com', u'cperson@example.org', |
1475 | - u'dperson@example.org', u'eperson@example.org') |
1476 | + 'bart.person@example.com', 'cperson@example.org', |
1477 | + 'dperson@example.org', 'eperson@example.org') |
1478 | |
1479 | def test_logging(self): |
1480 | # Test that nothing gets logged when all imports are fine. |
1481 | @@ -381,7 +381,7 @@ class TestMailingListImportScript(BaseMailingListImportTest): |
1482 | layer = AppServerLayer |
1483 | |
1484 | def setUp(self): |
1485 | - super(TestMailingListImportScript, self).setUp() |
1486 | + super().setUp() |
1487 | # Since these tests involve two processes, the setup transaction must |
1488 | # be committed, otherwise the script won't see the changes. |
1489 | transaction.commit() |
1490 | @@ -418,11 +418,11 @@ class TestMailingListImportScript(BaseMailingListImportTest): |
1491 | self.assertEqual(process.returncode, 0, stdout) |
1492 | # Make sure we hit the database. |
1493 | transaction.abort() |
1494 | - self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly') |
1495 | + self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly') |
1496 | self.assertAddresses( |
1497 | - u'anne.person@example.com', u'bart.person@example.com', |
1498 | - u'cperson@example.org', u'dperson@example.org', |
1499 | - u'eperson@example.org') |
1500 | + 'anne.person@example.com', 'bart.person@example.com', |
1501 | + 'cperson@example.org', 'dperson@example.org', |
1502 | + 'eperson@example.org') |
1503 | |
1504 | def test_notification_suppression(self): |
1505 | # Test that importing some addresses produces no notifications, which |
1506 | @@ -508,8 +508,8 @@ class TestImportToRestrictedList(BaseMailingListImportTest): |
1507 | 'dperson@example.org', |
1508 | 'elly.person@example.com', |
1509 | )) |
1510 | - self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly') |
1511 | + self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly') |
1512 | self.assertAddresses( |
1513 | - u'anne.person@example.com', u'bperson@example.org', |
1514 | - u'cris.person@example.com', u'dperson@example.org', |
1515 | - u'elly.person@example.com') |
1516 | + 'anne.person@example.com', 'bperson@example.org', |
1517 | + 'cris.person@example.com', 'dperson@example.org', |
1518 | + 'elly.person@example.com') |
1519 | diff --git a/lib/lp/registry/tests/test_nameblacklist.py b/lib/lp/registry/tests/test_nameblacklist.py |
1520 | index f533b93..30314ca 100644 |
1521 | --- a/lib/lp/registry/tests/test_nameblacklist.py |
1522 | +++ b/lib/lp/registry/tests/test_nameblacklist.py |
1523 | @@ -29,13 +29,13 @@ class TestNameBlacklist(TestCaseWithFactory): |
1524 | layer = ZopelessDatabaseLayer |
1525 | |
1526 | def setUp(self): |
1527 | - super(TestNameBlacklist, self).setUp() |
1528 | + super().setUp() |
1529 | self.name_blacklist_set = getUtility(INameBlacklistSet) |
1530 | - self.caret_foo_exp = self.name_blacklist_set.create(u'^foo') |
1531 | - self.foo_exp = self.name_blacklist_set.create(u'foo') |
1532 | - self.verbose_exp = self.name_blacklist_set.create(u'v e r b o s e') |
1533 | + self.caret_foo_exp = self.name_blacklist_set.create('^foo') |
1534 | + self.foo_exp = self.name_blacklist_set.create('foo') |
1535 | + self.verbose_exp = self.name_blacklist_set.create('v e r b o s e') |
1536 | team = self.factory.makeTeam() |
1537 | - self.admin_exp = self.name_blacklist_set.create(u'fnord', admin=team) |
1538 | + self.admin_exp = self.name_blacklist_set.create('fnord', admin=team) |
1539 | self.store = IStore(self.foo_exp) |
1540 | self.store.flush() |
1541 | |
1542 | @@ -59,16 +59,16 @@ class TestNameBlacklist(TestCaseWithFactory): |
1543 | def test_name_blacklist_match(self): |
1544 | |
1545 | # A name that is not blacklisted returns NULL/None |
1546 | - self.assertIsNone(self.name_blacklist_match(u"bar")) |
1547 | + self.assertIsNone(self.name_blacklist_match("bar")) |
1548 | |
1549 | # A name that is blacklisted returns the id of the row in the |
1550 | # NameBlacklist table that matched. Rows are tried in order, and the |
1551 | # first match is returned. |
1552 | self.assertEqual( |
1553 | - self.name_blacklist_match(u"foobar"), |
1554 | + self.name_blacklist_match("foobar"), |
1555 | self.caret_foo_exp.id) |
1556 | self.assertEqual( |
1557 | - self.name_blacklist_match(u"barfoo"), |
1558 | + self.name_blacklist_match("barfoo"), |
1559 | self.foo_exp.id) |
1560 | |
1561 | def test_name_blacklist_match_admin_does_not_match(self): |
1562 | @@ -76,7 +76,7 @@ class TestNameBlacklist(TestCaseWithFactory): |
1563 | # backlisted name restriction. |
1564 | user = self.admin_exp.admin.teamowner |
1565 | self.assertEqual( |
1566 | - None, self.name_blacklist_match(u"fnord", user.id)) |
1567 | + None, self.name_blacklist_match("fnord", user.id)) |
1568 | |
1569 | def test_name_blacklist_match_launchpad_admin_can_change(self): |
1570 | # A Launchpad admin is exempt from any backlisted name restriction |
1571 | @@ -85,7 +85,7 @@ class TestNameBlacklist(TestCaseWithFactory): |
1572 | admins = getUtility(ILaunchpadCelebrities).admin |
1573 | admins.addMember(user, user) |
1574 | self.assertEqual( |
1575 | - None, self.name_blacklist_match(u"fnord", user.id)) |
1576 | + None, self.name_blacklist_match("fnord", user.id)) |
1577 | |
1578 | def test_name_blacklist_match_launchpad_admin_cannot_change(self): |
1579 | # A Launchpad admin cannot override backlisted names without admins. |
1580 | @@ -93,42 +93,42 @@ class TestNameBlacklist(TestCaseWithFactory): |
1581 | admins = getUtility(ILaunchpadCelebrities).admin |
1582 | admins.addMember(user, user) |
1583 | self.assertEqual( |
1584 | - self.foo_exp.id, self.name_blacklist_match(u"barfoo", user.id)) |
1585 | + self.foo_exp.id, self.name_blacklist_match("barfoo", user.id)) |
1586 | |
1587 | def test_name_blacklist_match_cache(self): |
1588 | # If the blacklist is changed in the DB, these changes are noticed. |
1589 | # This test is needed because the stored procedure keeps a cache |
1590 | # of the compiled regular expressions. |
1591 | self.assertEqual( |
1592 | - self.name_blacklist_match(u"foobar"), |
1593 | + self.name_blacklist_match("foobar"), |
1594 | self.caret_foo_exp.id) |
1595 | - self.caret_foo_exp.regexp = u'nomatch' |
1596 | + self.caret_foo_exp.regexp = 'nomatch' |
1597 | self.assertEqual( |
1598 | - self.name_blacklist_match(u"foobar"), |
1599 | + self.name_blacklist_match("foobar"), |
1600 | self.foo_exp.id) |
1601 | - self.foo_exp.regexp = u'nomatch2' |
1602 | - self.assertIsNone(self.name_blacklist_match(u"foobar")) |
1603 | + self.foo_exp.regexp = 'nomatch2' |
1604 | + self.assertIsNone(self.name_blacklist_match("foobar")) |
1605 | |
1606 | def test_is_blacklisted_name(self): |
1607 | # is_blacklisted_name() is just a wrapper around name_blacklist_match |
1608 | # that is friendlier to use in a boolean context. |
1609 | - self.assertFalse(self.is_blacklisted_name(u"bar")) |
1610 | - self.assertTrue(self.is_blacklisted_name(u"foo")) |
1611 | - self.caret_foo_exp.regexp = u'bar' |
1612 | - self.foo_exp.regexp = u'bar2' |
1613 | - self.assertFalse(self.is_blacklisted_name(u"foo")) |
1614 | + self.assertFalse(self.is_blacklisted_name("bar")) |
1615 | + self.assertTrue(self.is_blacklisted_name("foo")) |
1616 | + self.caret_foo_exp.regexp = 'bar' |
1617 | + self.foo_exp.regexp = 'bar2' |
1618 | + self.assertFalse(self.is_blacklisted_name("foo")) |
1619 | |
1620 | def test_is_blacklisted_name_admin_false(self): |
1621 | # Users in the expression's admin team are will return False. |
1622 | user = self.admin_exp.admin.teamowner |
1623 | - self.assertFalse(self.is_blacklisted_name(u"fnord", user.id)) |
1624 | + self.assertFalse(self.is_blacklisted_name("fnord", user.id)) |
1625 | |
1626 | def test_case_insensitive(self): |
1627 | - self.assertTrue(self.is_blacklisted_name(u"Foo")) |
1628 | + self.assertTrue(self.is_blacklisted_name("Foo")) |
1629 | |
1630 | def test_verbose(self): |
1631 | # Testing the VERBOSE flag is used when compiling the regexp |
1632 | - self.assertTrue(self.is_blacklisted_name(u"verbose")) |
1633 | + self.assertTrue(self.is_blacklisted_name("verbose")) |
1634 | |
1635 | |
1636 | class TestNameBlacklistSet(TestCaseWithFactory): |
1637 | @@ -136,36 +136,36 @@ class TestNameBlacklistSet(TestCaseWithFactory): |
1638 | layer = DatabaseFunctionalLayer |
1639 | |
1640 | def setUp(self): |
1641 | - super(TestNameBlacklistSet, self).setUp() |
1642 | + super().setUp() |
1643 | login_celebrity('registry_experts') |
1644 | self.name_blacklist_set = getUtility(INameBlacklistSet) |
1645 | |
1646 | def test_create_with_one_arg(self): |
1647 | # Test NameBlacklistSet.create(regexp). |
1648 | - name_blacklist = self.name_blacklist_set.create(u'foo') |
1649 | + name_blacklist = self.name_blacklist_set.create('foo') |
1650 | self.assertTrue(verifyObject(INameBlacklist, name_blacklist)) |
1651 | - self.assertEqual(u'foo', name_blacklist.regexp) |
1652 | + self.assertEqual('foo', name_blacklist.regexp) |
1653 | self.assertIs(None, name_blacklist.comment) |
1654 | |
1655 | def test_create_with_two_args(self): |
1656 | # Test NameBlacklistSet.create(regexp, comment). |
1657 | - name_blacklist = self.name_blacklist_set.create(u'foo', u'bar') |
1658 | + name_blacklist = self.name_blacklist_set.create('foo', 'bar') |
1659 | self.assertTrue(verifyObject(INameBlacklist, name_blacklist)) |
1660 | - self.assertEqual(u'foo', name_blacklist.regexp) |
1661 | - self.assertEqual(u'bar', name_blacklist.comment) |
1662 | + self.assertEqual('foo', name_blacklist.regexp) |
1663 | + self.assertEqual('bar', name_blacklist.comment) |
1664 | |
1665 | def test_create_with_three_args(self): |
1666 | # Test NameBlacklistSet.create(regexp, comment, admin). |
1667 | team = self.factory.makeTeam() |
1668 | - name_blacklist = self.name_blacklist_set.create(u'foo', u'bar', team) |
1669 | + name_blacklist = self.name_blacklist_set.create('foo', 'bar', team) |
1670 | self.assertTrue(verifyObject(INameBlacklist, name_blacklist)) |
1671 | - self.assertEqual(u'foo', name_blacklist.regexp) |
1672 | - self.assertEqual(u'bar', name_blacklist.comment) |
1673 | + self.assertEqual('foo', name_blacklist.regexp) |
1674 | + self.assertEqual('bar', name_blacklist.comment) |
1675 | self.assertEqual(team, name_blacklist.admin) |
1676 | |
1677 | def test_get_int(self): |
1678 | # Test NameBlacklistSet.get() with int id. |
1679 | - name_blacklist = self.name_blacklist_set.create(u'foo', u'bar') |
1680 | + name_blacklist = self.name_blacklist_set.create('foo', 'bar') |
1681 | store = IStore(name_blacklist) |
1682 | store.flush() |
1683 | retrieved = self.name_blacklist_set.get(name_blacklist.id) |
1684 | @@ -173,7 +173,7 @@ class TestNameBlacklistSet(TestCaseWithFactory): |
1685 | |
1686 | def test_get_string(self): |
1687 | # Test NameBlacklistSet.get() with string id. |
1688 | - name_blacklist = self.name_blacklist_set.create(u'foo', u'bar') |
1689 | + name_blacklist = self.name_blacklist_set.create('foo', 'bar') |
1690 | store = IStore(name_blacklist) |
1691 | store.flush() |
1692 | retrieved = self.name_blacklist_set.get(str(name_blacklist.id)) |
1693 | @@ -213,7 +213,7 @@ class TestNameBlacklistSet(TestCaseWithFactory): |
1694 | def test_NameBlacklist_permissions(self): |
1695 | # Verify that non-registry-experts do not have permission to |
1696 | # access the NameBlacklist. |
1697 | - name_blacklist = self.name_blacklist_set.create(u'foo') |
1698 | + name_blacklist = self.name_blacklist_set.create('foo') |
1699 | self.assertTrue(check_permission('launchpad.View', name_blacklist)) |
1700 | self.assertTrue(check_permission('launchpad.Edit', name_blacklist)) |
1701 | login(ANONYMOUS) |
1702 | diff --git a/lib/lp/registry/tests/test_notification.py b/lib/lp/registry/tests/test_notification.py |
1703 | index ead0170..5d1a6a6 100644 |
1704 | --- a/lib/lp/registry/tests/test_notification.py |
1705 | +++ b/lib/lp/registry/tests/test_notification.py |
1706 | @@ -100,9 +100,9 @@ class SendDirectContactEmailTestCase(TestCaseWithFactory): |
1707 | |
1708 | def test_name_utf8_encoding(self): |
1709 | # Names are encoded in the From and To headers. |
1710 | - self.factory.makePerson(email='me@eg.dom', displayname=u'sn\xefrf') |
1711 | + self.factory.makePerson(email='me@eg.dom', displayname='sn\xefrf') |
1712 | user = self.factory.makePerson( |
1713 | - email='him@eg.dom', displayname=u'pti\xedng') |
1714 | + email='him@eg.dom', displayname='pti\xedng') |
1715 | recipients_set = NotificationRecipientSet() |
1716 | recipients_set.add(user, 'test reason', 'test rationale') |
1717 | pop_notifications() |
1718 | diff --git a/lib/lp/registry/tests/test_ociproject.py b/lib/lp/registry/tests/test_ociproject.py |
1719 | index 03036fb..14ec569 100644 |
1720 | --- a/lib/lp/registry/tests/test_ociproject.py |
1721 | +++ b/lib/lp/registry/tests/test_ociproject.py |
1722 | @@ -5,7 +5,6 @@ |
1723 | |
1724 | import json |
1725 | |
1726 | -from six import text_type |
1727 | from testtools.matchers import ( |
1728 | ContainsDict, |
1729 | Equals, |
1730 | @@ -230,7 +229,7 @@ class TestOCIProjectWebservice(TestCaseWithFactory): |
1731 | layer = DatabaseFunctionalLayer |
1732 | |
1733 | def setUp(self): |
1734 | - super(TestOCIProjectWebservice, self).setUp() |
1735 | + super().setUp() |
1736 | self.person = self.factory.makePerson(displayname="Test Person") |
1737 | self.other_person = self.factory.makePerson() |
1738 | self.webservice = webservice_for_person( |
1739 | @@ -244,7 +243,7 @@ class TestOCIProjectWebservice(TestCaseWithFactory): |
1740 | def getAbsoluteURL(self, target): |
1741 | """Get the webservice absolute URL of the given object or relative |
1742 | path.""" |
1743 | - if not isinstance(target, text_type): |
1744 | + if not isinstance(target, str): |
1745 | target = api_url(target) |
1746 | return self.webservice.getAbsoluteUrl(target) |
1747 | |
1748 | diff --git a/lib/lp/registry/tests/test_ociprojectseries.py b/lib/lp/registry/tests/test_ociprojectseries.py |
1749 | index a938a54..771e9ce 100644 |
1750 | --- a/lib/lp/registry/tests/test_ociprojectseries.py |
1751 | +++ b/lib/lp/registry/tests/test_ociprojectseries.py |
1752 | @@ -3,7 +3,6 @@ |
1753 | |
1754 | """Test OCIProjectSeries.""" |
1755 | |
1756 | -from six import string_types |
1757 | from testtools.matchers import ( |
1758 | ContainsDict, |
1759 | Equals, |
1760 | @@ -108,7 +107,7 @@ class TestOCIProjectSeriesWebservice(TestCaseWithFactory): |
1761 | layer = DatabaseFunctionalLayer |
1762 | |
1763 | def setUp(self): |
1764 | - super(TestOCIProjectSeriesWebservice, self).setUp() |
1765 | + super().setUp() |
1766 | self.person = self.factory.makePerson(displayname="Test Person") |
1767 | self.webservice = webservice_for_person( |
1768 | self.person, permission=OAuthPermission.WRITE_PUBLIC, |
1769 | @@ -117,7 +116,7 @@ class TestOCIProjectSeriesWebservice(TestCaseWithFactory): |
1770 | def getAbsoluteURL(self, target): |
1771 | """Get the webservice absolute URL of the given object or relative |
1772 | path.""" |
1773 | - if not isinstance(target, string_types): |
1774 | + if not isinstance(target, str): |
1775 | target = api_url(target) |
1776 | return self.webservice.getAbsoluteUrl(target) |
1777 | |
1778 | diff --git a/lib/lp/registry/tests/test_oopsreferences.py b/lib/lp/registry/tests/test_oopsreferences.py |
1779 | index 175795e..47e00fb 100644 |
1780 | --- a/lib/lp/registry/tests/test_oopsreferences.py |
1781 | +++ b/lib/lp/registry/tests/test_oopsreferences.py |
1782 | @@ -28,7 +28,7 @@ class TestOopsReferences(TestCaseWithFactory): |
1783 | layer = DatabaseFunctionalLayer |
1784 | |
1785 | def setUp(self): |
1786 | - super(TestOopsReferences, self).setUp() |
1787 | + super().setUp() |
1788 | self.store = IStore(Message) |
1789 | |
1790 | def test_oops_in_messagechunk(self): |
1791 | @@ -90,7 +90,7 @@ class TestOopsReferences(TestCaseWithFactory): |
1792 | |
1793 | def test_oops_in_question_title(self): |
1794 | oopsid = "OOPS-abcdef1234" |
1795 | - question = self.factory.makeQuestion(title=u"Crash with %s" % oopsid) |
1796 | + question = self.factory.makeQuestion(title="Crash with %s" % oopsid) |
1797 | self.store.flush() |
1798 | now = datetime.now(tz=utc) |
1799 | day = timedelta(days=1) |
1800 | @@ -105,7 +105,7 @@ class TestOopsReferences(TestCaseWithFactory): |
1801 | |
1802 | def test_oops_in_question_wrong_context(self): |
1803 | oopsid = "OOPS-abcdef1234" |
1804 | - question = self.factory.makeQuestion(title=u"Crash with %s" % oopsid) |
1805 | + question = self.factory.makeQuestion(title="Crash with %s" % oopsid) |
1806 | self.store.flush() |
1807 | now = datetime.now(tz=utc) |
1808 | day = timedelta(days=1) |
1809 | @@ -118,7 +118,7 @@ class TestOopsReferences(TestCaseWithFactory): |
1810 | def test_oops_in_question_description(self): |
1811 | oopsid = "OOPS-abcdef1234" |
1812 | question = self.factory.makeQuestion( |
1813 | - description=u"Crash with %s" % oopsid) |
1814 | + description="Crash with %s" % oopsid) |
1815 | self.store.flush() |
1816 | now = datetime.now(tz=utc) |
1817 | day = timedelta(days=1) |
1818 | @@ -135,7 +135,7 @@ class TestOopsReferences(TestCaseWithFactory): |
1819 | oopsid = "OOPS-abcdef1234" |
1820 | question = self.factory.makeQuestion() |
1821 | with person_logged_in(question.owner): |
1822 | - question.whiteboard = u"Crash with %s" % oopsid |
1823 | + question.whiteboard = "Crash with %s" % oopsid |
1824 | self.store.flush() |
1825 | now = datetime.now(tz=utc) |
1826 | day = timedelta(days=1) |
1827 | @@ -153,7 +153,7 @@ class TestOopsReferences(TestCaseWithFactory): |
1828 | distro = self.factory.makeDistribution() |
1829 | question = self.factory.makeQuestion(target=distro) |
1830 | with person_logged_in(question.owner): |
1831 | - question.whiteboard = u"Crash with %s" % oopsid |
1832 | + question.whiteboard = "Crash with %s" % oopsid |
1833 | self.store.flush() |
1834 | now = datetime.now(tz=utc) |
1835 | day = timedelta(days=1) |
1836 | diff --git a/lib/lp/registry/tests/test_person.py b/lib/lp/registry/tests/test_person.py |
1837 | index a7df518..05a7d0e 100644 |
1838 | --- a/lib/lp/registry/tests/test_person.py |
1839 | +++ b/lib/lp/registry/tests/test_person.py |
1840 | @@ -88,7 +88,7 @@ class TestPersonTeams(TestCaseWithFactory): |
1841 | layer = DatabaseFunctionalLayer |
1842 | |
1843 | def setUp(self): |
1844 | - super(TestPersonTeams, self).setUp() |
1845 | + super().setUp() |
1846 | self.user = self.factory.makePerson(name="test-member") |
1847 | self.a_team = self.factory.makeTeam(name='a') |
1848 | self.b_team = self.factory.makeTeam(name='b', owner=self.a_team) |
1849 | @@ -428,15 +428,15 @@ class TestPerson(TestCaseWithFactory): |
1850 | # Users can see their own non-public affiliated products. |
1851 | owner = self.factory.makePerson() |
1852 | self.factory.makeProduct( |
1853 | - name=u'proprietary', |
1854 | + name='proprietary', |
1855 | information_type=InformationType.PROPRIETARY, |
1856 | owner=owner) |
1857 | self.factory.makeProduct( |
1858 | - name=u'public', |
1859 | + name='public', |
1860 | information_type=InformationType.PUBLIC, |
1861 | owner=owner) |
1862 | |
1863 | - expected_pillars = [u'proprietary', u'public'] |
1864 | + expected_pillars = ['proprietary', 'public'] |
1865 | received_pillars = [pillar.name for pillar in |
1866 | owner.getAffiliatedPillars(owner)] |
1867 | self.assertEqual(expected_pillars, received_pillars) |
1868 | @@ -446,15 +446,15 @@ class TestPerson(TestCaseWithFactory): |
1869 | owner = self.factory.makePerson() |
1870 | admin = self.factory.makeAdministrator() |
1871 | self.factory.makeProduct( |
1872 | - name=u'proprietary', |
1873 | + name='proprietary', |
1874 | information_type=InformationType.PROPRIETARY, |
1875 | owner=owner) |
1876 | self.factory.makeProduct( |
1877 | - name=u'public', |
1878 | + name='public', |
1879 | information_type=InformationType.PUBLIC, |
1880 | owner=owner) |
1881 | |
1882 | - expected_pillars = [u'proprietary', u'public'] |
1883 | + expected_pillars = ['proprietary', 'public'] |
1884 | received_pillars = [pillar.name for pillar in |
1885 | owner.getAffiliatedPillars(admin)] |
1886 | self.assertEqual(expected_pillars, received_pillars) |
1887 | @@ -464,15 +464,15 @@ class TestPerson(TestCaseWithFactory): |
1888 | owner = self.factory.makePerson() |
1889 | admin = self.factory.makeCommercialAdmin() |
1890 | self.factory.makeProduct( |
1891 | - name=u'proprietary', |
1892 | + name='proprietary', |
1893 | information_type=InformationType.PROPRIETARY, |
1894 | owner=owner) |
1895 | self.factory.makeProduct( |
1896 | - name=u'public', |
1897 | + name='public', |
1898 | information_type=InformationType.PUBLIC, |
1899 | owner=owner) |
1900 | |
1901 | - expected_pillars = [u'proprietary', u'public'] |
1902 | + expected_pillars = ['proprietary', 'public'] |
1903 | received_pillars = [pillar.name for pillar in |
1904 | owner.getAffiliatedPillars(admin)] |
1905 | self.assertEqual(expected_pillars, received_pillars) |
1906 | @@ -992,7 +992,7 @@ class TestPersonStates(TestCaseWithFactory): |
1907 | def test_person_repr_ansii(self): |
1908 | # Verify that ANSI displayname is ascii safe. |
1909 | person = self.factory.makePerson( |
1910 | - name="user", displayname=u'\xdc-tester') |
1911 | + name="user", displayname='\xdc-tester') |
1912 | ignore, name, displayname = repr(person).rsplit(' ', 2) |
1913 | self.assertEqual('user', name) |
1914 | self.assertEqual('(\\xdc-tester)>', displayname) |
1915 | @@ -1000,7 +1000,7 @@ class TestPersonStates(TestCaseWithFactory): |
1916 | def test_person_repr_unicode(self): |
1917 | # Verify that Unicode displayname is ascii safe. |
1918 | person = self.factory.makePerson( |
1919 | - name="user", displayname=u'\u0170-tester') |
1920 | + name="user", displayname='\u0170-tester') |
1921 | ignore, displayname = repr(person).rsplit(' ', 1) |
1922 | self.assertEqual('(\\u0170-tester)>', displayname) |
1923 | |
1924 | @@ -1010,7 +1010,7 @@ class TestPersonRelatedBugTaskSearch(TestCaseWithFactory): |
1925 | layer = DatabaseFunctionalLayer |
1926 | |
1927 | def setUp(self): |
1928 | - super(TestPersonRelatedBugTaskSearch, self).setUp() |
1929 | + super().setUp() |
1930 | self.user = self.factory.makePerson(displayname="User") |
1931 | self.context = self.factory.makePerson(displayname="Context") |
1932 | |
1933 | @@ -1157,7 +1157,7 @@ class TestPersonKarma(TestCaseWithFactory, KarmaTestMixin): |
1934 | layer = DatabaseFunctionalLayer |
1935 | |
1936 | def setUp(self): |
1937 | - super(TestPersonKarma, self).setUp() |
1938 | + super().setUp() |
1939 | self.person = self.factory.makePerson() |
1940 | a_product = self.factory.makeProduct(name='aa') |
1941 | b_product = self.factory.makeProduct(name='bb') |
1942 | @@ -1295,7 +1295,7 @@ class TestGetRecipients(TestCaseWithFactory): |
1943 | layer = DatabaseFunctionalLayer |
1944 | |
1945 | def setUp(self): |
1946 | - super(TestGetRecipients, self).setUp() |
1947 | + super().setUp() |
1948 | login('foo.bar@canonical.com') |
1949 | |
1950 | def test_get_recipients_indirect(self): |
1951 | @@ -1365,7 +1365,7 @@ class TestGetRecipients(TestCaseWithFactory): |
1952 | super_team_member_team, |
1953 | self.makePersonWithNoPreferredEmail()]) |
1954 | super_team_member_team.acceptInvitationToBeMemberOf( |
1955 | - super_team, u'Go Team!') |
1956 | + super_team, 'Go Team!') |
1957 | recipients = list(get_recipients(super_team)) |
1958 | self.assertEqual({owner, |
1959 | super_team_member_person, |
1960 | @@ -1410,7 +1410,7 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory): |
1961 | layer = DatabaseFunctionalLayer |
1962 | |
1963 | def setUp(self): |
1964 | - super(Test_getAssignedSpecificationWorkItemsDueBefore, self).setUp() |
1965 | + super().setUp() |
1966 | self.team = self.factory.makeTeam() |
1967 | today = datetime.today().date() |
1968 | next_month = today + timedelta(days=30) |
1969 | @@ -1428,13 +1428,13 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory): |
1970 | # Create a workitem with no explicit assignee/milestone. This way it |
1971 | # will inherit the ones from the spec it belongs to. |
1972 | workitem = self.factory.makeSpecificationWorkItem( |
1973 | - title=u'workitem 1', specification=assigned_spec) |
1974 | + title='workitem 1', specification=assigned_spec) |
1975 | |
1976 | # Create a workitem targeted to a milestone too far in the future. |
1977 | # This workitem must not be in the list returned by |
1978 | # getAssignedSpecificationWorkItemsDueBefore(). |
1979 | self.factory.makeSpecificationWorkItem( |
1980 | - title=u'workitem 2', specification=assigned_spec, |
1981 | + title='workitem 2', specification=assigned_spec, |
1982 | milestone=self.future_milestone) |
1983 | |
1984 | workitems = self.team.getAssignedSpecificationWorkItemsDueBefore( |
1985 | @@ -1448,7 +1448,7 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory): |
1986 | product=self.product) |
1987 | # Create a deleted work item. |
1988 | self.factory.makeSpecificationWorkItem( |
1989 | - title=u'workitem', specification=assigned_spec, deleted=True) |
1990 | + title='workitem', specification=assigned_spec, deleted=True) |
1991 | |
1992 | workitems = self.team.getAssignedSpecificationWorkItemsDueBefore( |
1993 | self.current_milestone.dateexpected, self.team) |
1994 | @@ -1461,13 +1461,13 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory): |
1995 | # Create a workitem with no explicit assignee/milestone. This way it |
1996 | # will inherit the ones from the spec it belongs to. |
1997 | workitem = self.factory.makeSpecificationWorkItem( |
1998 | - title=u'workitem 1', specification=assigned_spec) |
1999 | + title='workitem 1', specification=assigned_spec) |
2000 | |
2001 | # Create a workitem with somebody who's not a member of our team as |
2002 | # the assignee. This workitem must be in the list returned by |
2003 | # getAssignedSpecificationWorkItemsDueBefore(). |
2004 | workitem_for_other_person = self.factory.makeSpecificationWorkItem( |
2005 | - title=u'workitem 2', specification=assigned_spec, |
2006 | + title='workitem 2', specification=assigned_spec, |
2007 | assignee=self.factory.makePerson()) |
2008 | |
2009 | workitems = self.team.getAssignedSpecificationWorkItemsDueBefore( |
2010 | @@ -1484,7 +1484,7 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory): |
2011 | assignee=self.team.teamowner, milestone=milestone, |
2012 | product=milestone.product) |
2013 | self.factory.makeSpecificationWorkItem( |
2014 | - title=u'workitem 1', specification=spec) |
2015 | + title='workitem 1', specification=spec) |
2016 | |
2017 | workitems = self.team.getAssignedSpecificationWorkItemsDueBefore( |
2018 | today, self.team) |
2019 | @@ -1498,12 +1498,12 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory): |
2020 | # This workitem inherits the spec's milestone and that's too far in |
2021 | # the future so it won't be in the returned list. |
2022 | self.factory.makeSpecificationWorkItem( |
2023 | - title=u'workitem 1', specification=assigned_spec) |
2024 | + title='workitem 1', specification=assigned_spec) |
2025 | # This one, on the other hand, is explicitly targeted to the current |
2026 | # milestone, so it is included in the returned list even though its |
2027 | # spec is targeted to the future milestone. |
2028 | workitem = self.factory.makeSpecificationWorkItem( |
2029 | - title=u'workitem 2', specification=assigned_spec, |
2030 | + title='workitem 2', specification=assigned_spec, |
2031 | milestone=self.current_milestone) |
2032 | |
2033 | workitems = self.team.getAssignedSpecificationWorkItemsDueBefore( |
2034 | @@ -1521,13 +1521,13 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory): |
2035 | # This one is not explicitly assigned to anyone, so it inherits the |
2036 | # assignee of its spec and hence is not in the returned list. |
2037 | self.factory.makeSpecificationWorkItem( |
2038 | - title=u'workitem 1', specification=foreign_spec) |
2039 | + title='workitem 1', specification=foreign_spec) |
2040 | |
2041 | # This one, on the other hand, is explicitly assigned to the a member |
2042 | # of our team, so it is included in the returned list even though its |
2043 | # spec is not assigned to a member of our team. |
2044 | workitem = self.factory.makeSpecificationWorkItem( |
2045 | - title=u'workitem 2', specification=foreign_spec, |
2046 | + title='workitem 2', specification=foreign_spec, |
2047 | assignee=self.team.teamowner) |
2048 | |
2049 | workitems = self.team.getAssignedSpecificationWorkItemsDueBefore( |
2050 | @@ -1588,11 +1588,11 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory): |
2051 | for i in range(5): |
2052 | spec = self._makeProductSpec(dateexpected) |
2053 | self.factory.makeSpecificationWorkItem( |
2054 | - title=u'product work item %d' % i, assignee=spec.assignee, |
2055 | + title='product work item %d' % i, assignee=spec.assignee, |
2056 | milestone=spec.milestone, specification=spec) |
2057 | spec2 = self._makeDistroSpec(dateexpected) |
2058 | self.factory.makeSpecificationWorkItem( |
2059 | - title=u'distro work item %d' % i, assignee=spec2.assignee, |
2060 | + title='distro work item %d' % i, assignee=spec2.assignee, |
2061 | milestone=spec2.milestone, specification=spec2) |
2062 | flush_database_updates() |
2063 | flush_database_caches() |
2064 | @@ -1622,7 +1622,7 @@ class Test_getAssignedBugTasksDueBefore(TestCaseWithFactory): |
2065 | layer = DatabaseFunctionalLayer |
2066 | |
2067 | def setUp(self): |
2068 | - super(Test_getAssignedBugTasksDueBefore, self).setUp() |
2069 | + super().setUp() |
2070 | self.team = self.factory.makeTeam() |
2071 | self.today = datetime.today().date() |
2072 | |
2073 | @@ -1804,7 +1804,7 @@ class TestSpecifications(TestCaseWithFactory): |
2074 | layer = DatabaseFunctionalLayer |
2075 | |
2076 | def setUp(self): |
2077 | - super(TestSpecifications, self).setUp() |
2078 | + super().setUp() |
2079 | self.date_created = datetime.now(pytz.utc) |
2080 | |
2081 | def makeSpec(self, owner=None, date_created=0, title=None, |
2082 | @@ -1988,9 +1988,9 @@ class TestSpecifications(TestCaseWithFactory): |
2083 | blueprint1 = self.makeSpec(title='abc') |
2084 | owner = blueprint1.owner |
2085 | blueprint2 = self.makeSpec(owner, title='def') |
2086 | - result = list_result(owner, [u'abc']) |
2087 | + result = list_result(owner, ['abc']) |
2088 | self.assertEqual([blueprint1], result) |
2089 | - result = list_result(owner, [u'def']) |
2090 | + result = list_result(owner, ['def']) |
2091 | self.assertEqual([blueprint2], result) |
2092 | |
2093 | def test_proprietary_not_listed(self): |
2094 | diff --git a/lib/lp/registry/tests/test_person_close_account_job.py b/lib/lp/registry/tests/test_person_close_account_job.py |
2095 | index f7ecc35..26e3d50 100644 |
2096 | --- a/lib/lp/registry/tests/test_person_close_account_job.py |
2097 | +++ b/lib/lp/registry/tests/test_person_close_account_job.py |
2098 | @@ -42,7 +42,7 @@ class TestPersonCloseAccountJob(TestCaseWithFactory): |
2099 | layer = LaunchpadZopelessLayer |
2100 | |
2101 | def test_close_account_job_valid_username(self): |
2102 | - user_to_delete = self.factory.makePerson(name=u'delete-me') |
2103 | + user_to_delete = self.factory.makePerson(name='delete-me') |
2104 | job_source = getUtility(IPersonCloseAccountJobSource) |
2105 | jobs = list(job_source.iterReady()) |
2106 | |
2107 | @@ -57,11 +57,11 @@ class TestPersonCloseAccountJob(TestCaseWithFactory): |
2108 | self.assertEqual(JobStatus.COMPLETED, jobs[0].status) |
2109 | person = removeSecurityProxy( |
2110 | getUtility(IPersonSet).getByName(user_to_delete.name)) |
2111 | - self.assertEqual(person.name, u'removed%d' % user_to_delete.id) |
2112 | + self.assertEqual(person.name, 'removed%d' % user_to_delete.id) |
2113 | |
2114 | def test_close_account_job_valid_email(self): |
2115 | user_to_delete = self.factory.makePerson( |
2116 | - email=u'delete-me@example.com') |
2117 | + email='delete-me@example.com') |
2118 | getUtility( |
2119 | IPersonCloseAccountJobSource).create(user_to_delete) |
2120 | job_source = getUtility(IPersonCloseAccountJobSource) |
2121 | @@ -71,7 +71,7 @@ class TestPersonCloseAccountJob(TestCaseWithFactory): |
2122 | self.assertEqual(JobStatus.COMPLETED, jobs[0].status) |
2123 | person = removeSecurityProxy( |
2124 | getUtility(IPersonSet).getByName(user_to_delete.name)) |
2125 | - self.assertEqual(person.name, u'removed%d' % user_to_delete.id) |
2126 | + self.assertEqual(person.name, 'removed%d' % user_to_delete.id) |
2127 | |
2128 | def test_team(self): |
2129 | team = self.factory.makeTeam() |
2130 | @@ -82,7 +82,7 @@ class TestPersonCloseAccountJob(TestCaseWithFactory): |
2131 | team) |
2132 | |
2133 | def test_unhandled_reference(self): |
2134 | - user_to_delete = self.factory.makePerson(name=u'delete-me') |
2135 | + user_to_delete = self.factory.makePerson(name='delete-me') |
2136 | self.factory.makeProduct(owner=user_to_delete) |
2137 | person = removeSecurityProxy( |
2138 | getUtility(IPersonSet).getByName(user_to_delete.name)) |
2139 | @@ -94,10 +94,10 @@ class TestPersonCloseAccountJob(TestCaseWithFactory): |
2140 | dbuser(config.IPersonCloseAccountJobSource.dbuser): |
2141 | job.run() |
2142 | error_message = ( |
2143 | - {u'ERROR User delete-me is still ' |
2144 | - u'referenced by 1 product.owner values', |
2145 | - u'ERROR User delete-me is still ' |
2146 | - u'referenced by 1 productseries.owner values', |
2147 | + {'ERROR User delete-me is still ' |
2148 | + 'referenced by 1 product.owner values', |
2149 | + 'ERROR User delete-me is still ' |
2150 | + 'referenced by 1 productseries.owner values', |
2151 | }) |
2152 | self.assertTrue( |
2153 | error_message.issubset(logger.getLogBuffer().splitlines())) |
2154 | @@ -133,4 +133,4 @@ class TestPersonCloseAccountJobViaCelery(TestCaseWithFactory): |
2155 | person = removeSecurityProxy( |
2156 | getUtility(IPersonSet).getByName(user_to_delete.name)) |
2157 | self.assertEqual(JobStatus.COMPLETED, job.status) |
2158 | - self.assertEqual(person.name, u'removed%d' % user_to_delete.id) |
2159 | + self.assertEqual(person.name, 'removed%d' % user_to_delete.id) |
2160 | diff --git a/lib/lp/registry/tests/test_person_merge_job.py b/lib/lp/registry/tests/test_person_merge_job.py |
2161 | index 99f943d..fcf0ca5 100644 |
2162 | --- a/lib/lp/registry/tests/test_person_merge_job.py |
2163 | +++ b/lib/lp/registry/tests/test_person_merge_job.py |
2164 | @@ -64,7 +64,7 @@ class TestPersonMergeJob(TestCaseWithFactory): |
2165 | layer = DatabaseFunctionalLayer |
2166 | |
2167 | def setUp(self): |
2168 | - super(TestPersonMergeJob, self).setUp() |
2169 | + super().setUp() |
2170 | self.job_source = getUtility(IPersonMergeJobSource) |
2171 | self.job = create_job(self.factory) |
2172 | self.from_person = self.job.from_person |
2173 | diff --git a/lib/lp/registry/tests/test_person_sort_key.py b/lib/lp/registry/tests/test_person_sort_key.py |
2174 | index 64b82bb..ec45cb8 100644 |
2175 | --- a/lib/lp/registry/tests/test_person_sort_key.py |
2176 | +++ b/lib/lp/registry/tests/test_person_sort_key.py |
2177 | @@ -14,41 +14,41 @@ class TestPersonSortKeyBase: |
2178 | # person_sort_key returns the concatenation of the display name and |
2179 | # the name for use in sorting. |
2180 | self.assertSortKeysEqual( |
2181 | - u"Stuart Bishop", u"stub", |
2182 | - u"stuart bishop, stub") |
2183 | + "Stuart Bishop", "stub", |
2184 | + "stuart bishop, stub") |
2185 | |
2186 | def test_whitespace(self): |
2187 | # Leading and trailing whitespace is removed. |
2188 | self.assertSortKeysEqual( |
2189 | - u" Stuart Bishop\t", u"stub", |
2190 | - u"stuart bishop, stub") |
2191 | + " Stuart Bishop\t", "stub", |
2192 | + "stuart bishop, stub") |
2193 | |
2194 | def test_valid_name_is_assumed(self): |
2195 | # 'name' is assumed to be lowercase and not containing anything we |
2196 | # don't want. This should never happen as the valid_name database |
2197 | # constraint should prevent it. |
2198 | self.assertSortKeysEqual( |
2199 | - u"Stuart Bishop", u" stub42!!!", |
2200 | - u"stuart bishop, stub42!!!") |
2201 | + "Stuart Bishop", " stub42!!!", |
2202 | + "stuart bishop, stub42!!!") |
2203 | |
2204 | def test_strip_all_but_letters_and_whitespace(self): |
2205 | # Everything except for letters and whitespace is stripped. |
2206 | self.assertSortKeysEqual( |
2207 | - u"-= Mass1v3 T0SSA =-", u"tossa", |
2208 | - u"massv tssa, tossa") |
2209 | + "-= Mass1v3 T0SSA =-", "tossa", |
2210 | + "massv tssa, tossa") |
2211 | |
2212 | def test_non_ascii_allowed(self): |
2213 | # Non ASCII letters are currently allowed. Eventually they should |
2214 | # become transliterated to ASCII but we don't do this yet. |
2215 | self.assertSortKeysEqual( |
2216 | - u"Bj\N{LATIN SMALL LETTER O WITH DIAERESIS}rn", "bjorn", |
2217 | - u"bj\xf6rn, bjorn") |
2218 | + "Bj\N{LATIN SMALL LETTER O WITH DIAERESIS}rn", "bjorn", |
2219 | + "bj\xf6rn, bjorn") |
2220 | |
2221 | def test_unicode_case_conversion(self): |
2222 | # Case conversion is handled correctly using Unicode. |
2223 | self.assertSortKeysEqual( |
2224 | - u"Bj\N{LATIN CAPITAL LETTER O WITH DIAERESIS}rn", "bjorn", |
2225 | - u"bj\xf6rn, bjorn") # Lower case o with diaeresis |
2226 | + "Bj\N{LATIN CAPITAL LETTER O WITH DIAERESIS}rn", "bjorn", |
2227 | + "bj\xf6rn, bjorn") # Lower case o with diaeresis |
2228 | |
2229 | |
2230 | class TestPersonSortKeyInDatabase(TestPersonSortKeyBase, TestCase): |
2231 | @@ -56,12 +56,12 @@ class TestPersonSortKeyInDatabase(TestPersonSortKeyBase, TestCase): |
2232 | layer = DatabaseLayer |
2233 | |
2234 | def setUp(self): |
2235 | - super(TestPersonSortKeyInDatabase, self).setUp() |
2236 | + super().setUp() |
2237 | self.con = self.layer.connect() |
2238 | self.cur = self.con.cursor() |
2239 | |
2240 | def tearDown(self): |
2241 | - super(TestPersonSortKeyInDatabase, self).tearDown() |
2242 | + super().tearDown() |
2243 | self.con.close() |
2244 | |
2245 | def get_person_sort_key(self, display_name, name): |
2246 | diff --git a/lib/lp/registry/tests/test_person_vocabularies.py b/lib/lp/registry/tests/test_person_vocabularies.py |
2247 | index ea0cfcc..20a9d94 100644 |
2248 | --- a/lib/lp/registry/tests/test_person_vocabularies.py |
2249 | +++ b/lib/lp/registry/tests/test_person_vocabularies.py |
2250 | @@ -37,7 +37,7 @@ class VocabularyTestBase: |
2251 | vocabulary_name = None |
2252 | |
2253 | def setUp(self): |
2254 | - super(VocabularyTestBase, self).setUp() |
2255 | + super().setUp() |
2256 | self.vocabulary_registry = getVocabularyRegistry() |
2257 | |
2258 | def getVocabulary(self, context): |
2259 | @@ -85,18 +85,18 @@ class ValidPersonOrTeamVocabularyMixin(VocabularyTestBase): |
2260 | # Exact is better than prefix is better than FTI. |
2261 | self.assertEqual( |
2262 | [exact_person, prefix_person, contributor_person], |
2263 | - list(self.searchVocabulary(product, u'fooix'))) |
2264 | + list(self.searchVocabulary(product, 'fooix'))) |
2265 | |
2266 | # But karma can bump people up, behind the exact match. |
2267 | self.addKarma(contributor_person, 500, product=product) |
2268 | self.assertEqual( |
2269 | [exact_person, contributor_person, prefix_person], |
2270 | - list(self.searchVocabulary(product, u'fooix'))) |
2271 | + list(self.searchVocabulary(product, 'fooix'))) |
2272 | |
2273 | self.addKarma(prefix_person, 500, product=product) |
2274 | self.assertEqual( |
2275 | [exact_person, prefix_person, contributor_person], |
2276 | - list(self.searchVocabulary(product, u'fooix'))) |
2277 | + list(self.searchVocabulary(product, 'fooix'))) |
2278 | |
2279 | def assertKarmaContextConstraint(self, expected, context): |
2280 | """Check that the karma context constraint works. |
2281 | @@ -138,7 +138,7 @@ class ValidPersonOrTeamVocabularyMixin(VocabularyTestBase): |
2282 | results = self.searchVocabulary(None, '', 'PERSON') |
2283 | for personorteam in results: |
2284 | self.assertFalse(personorteam.is_team) |
2285 | - results = self.searchVocabulary(None, u'fred', 'PERSON') |
2286 | + results = self.searchVocabulary(None, 'fred', 'PERSON') |
2287 | self.assertEqual([person], list(results)) |
2288 | |
2289 | def test_person_filter(self): |
2290 | @@ -153,7 +153,7 @@ class ValidPersonOrTeamVocabularyMixin(VocabularyTestBase): |
2291 | results = self.searchVocabulary(None, '', 'TEAM') |
2292 | for personorteam in results: |
2293 | self.assertTrue(personorteam.is_team) |
2294 | - results = self.searchVocabulary(None, u'fred', 'TEAM') |
2295 | + results = self.searchVocabulary(None, 'fred', 'TEAM') |
2296 | self.assertContentEqual(teams, list(results)) |
2297 | |
2298 | def test_inactive_people_ignored(self): |
2299 | @@ -229,7 +229,7 @@ class TestValidPersonOrTeamPreloading(VocabularyTestBase, |
2300 | person.id: person.preferredemail for person in people} |
2301 | Store.of(people[0]).invalidate() |
2302 | |
2303 | - results = list(self.searchVocabulary(None, u'foobar')) |
2304 | + results = list(self.searchVocabulary(None, 'foobar')) |
2305 | with StormStatementRecorder() as recorder: |
2306 | self.assertEqual(4, len(results)) |
2307 | for person in results: |
2308 | diff --git a/lib/lp/registry/tests/test_personmerge.py b/lib/lp/registry/tests/test_personmerge.py |
2309 | index 0b5e264..cf53fbd 100644 |
2310 | --- a/lib/lp/registry/tests/test_personmerge.py |
2311 | +++ b/lib/lp/registry/tests/test_personmerge.py |
2312 | @@ -80,7 +80,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2313 | layer = DatabaseFunctionalLayer |
2314 | |
2315 | def setUp(self): |
2316 | - super(TestMergePeople, self).setUp() |
2317 | + super().setUp() |
2318 | self.person_set = getUtility(IPersonSet) |
2319 | |
2320 | def _do_premerge(self, from_person, to_person): |
2321 | @@ -281,7 +281,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2322 | duplicate, mergee = self._do_merge(duplicate, mergee) |
2323 | branches = [b.name for b in mergee.getBranches()] |
2324 | self.assertEqual(2, len(branches)) |
2325 | - self.assertContentEqual([u'foo', u'foo-1'], branches) |
2326 | + self.assertContentEqual(['foo', 'foo-1'], branches) |
2327 | |
2328 | def test_merge_moves_git_repositories(self): |
2329 | # When person/teams are merged, Git repositories owned by the from |
2330 | @@ -301,9 +301,9 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2331 | # name, merging renames the duplicate from the from person's side. |
2332 | project = self.factory.makeProduct() |
2333 | from_repository = self.factory.makeGitRepository( |
2334 | - target=project, name=u'foo') |
2335 | + target=project, name='foo') |
2336 | to_repository = self.factory.makeGitRepository( |
2337 | - target=project, name=u'foo') |
2338 | + target=project, name='foo') |
2339 | mergee = to_repository.owner |
2340 | duplicate = from_repository.owner |
2341 | self._do_premerge(duplicate, mergee) |
2342 | @@ -313,7 +313,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2343 | repositories = [ |
2344 | r.name for r in repository_set.getRepositories(None, mergee)] |
2345 | self.assertEqual(2, len(repositories)) |
2346 | - self.assertContentEqual([u'foo', u'foo-1'], repositories) |
2347 | + self.assertContentEqual(['foo', 'foo-1'], repositories) |
2348 | |
2349 | def test_merge_moves_recipes(self): |
2350 | # When person/teams are merged, recipes owned by the from person are |
2351 | @@ -333,9 +333,9 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2352 | # If both the from and to people have recipes with the same name, |
2353 | # merging renames the duplicate from the from person's side. |
2354 | merge_from = self.factory.makeSourcePackageRecipe( |
2355 | - name=u'foo', description=u'FROM') |
2356 | + name='foo', description='FROM') |
2357 | merge_to = self.factory.makeSourcePackageRecipe( |
2358 | - name=u'foo', description=u'TO') |
2359 | + name='foo', description='TO') |
2360 | duplicate = merge_from.owner |
2361 | mergee = merge_to.owner |
2362 | # Delete merge_from's PPA, which is required for the merge to work. |
2363 | @@ -347,8 +347,8 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2364 | recipes = mergee.recipes |
2365 | self.assertEqual(2, recipes.count()) |
2366 | descriptions = [r.description for r in recipes] |
2367 | - self.assertEqual([u'TO', u'FROM'], descriptions) |
2368 | - self.assertEqual(u'foo-1', recipes[1].name) |
2369 | + self.assertEqual(['TO', 'FROM'], descriptions) |
2370 | + self.assertEqual('foo-1', recipes[1].name) |
2371 | |
2372 | def assertSubscriptionMerges(self, target): |
2373 | # Given a subscription target, we want to make sure that subscriptions |
2374 | @@ -378,7 +378,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2375 | # The description lets us show that we still have the right |
2376 | # subscription later. |
2377 | target.addBugSubscriptionFilter(person, person).description = ( |
2378 | - u'a marker') |
2379 | + 'a marker') |
2380 | self._do_premerge(duplicate, person) |
2381 | login_person(person) |
2382 | duplicate, person = self._do_merge(duplicate, person) |
2383 | @@ -386,7 +386,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2384 | # by the marker name. |
2385 | self.assertEqual( |
2386 | target.getSubscription(person).bug_filters[0].description, |
2387 | - u'a marker') |
2388 | + 'a marker') |
2389 | # The conflicting subscription on the duplicate has been deleted. |
2390 | self.assertTrue(target.getSubscription(duplicate) is None) |
2391 | |
2392 | @@ -543,7 +543,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2393 | rule=rule, grantee=other_person, can_push=True) |
2394 | |
2395 | other_rule = self.factory.makeGitRule( |
2396 | - rule.repository, ref_pattern=u"refs/heads/other/*") |
2397 | + rule.repository, ref_pattern="refs/heads/other/*") |
2398 | self.factory.makeGitRuleGrant( |
2399 | rule=other_rule, grantee=other_person, can_force_push=True) |
2400 | |
2401 | @@ -607,7 +607,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2402 | def test_merge_moves_livefses(self): |
2403 | # When person/teams are merged, live filesystems owned by the from |
2404 | # person are moved. |
2405 | - self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"})) |
2406 | + self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"})) |
2407 | duplicate = self.factory.makePerson() |
2408 | mergee = self.factory.makePerson() |
2409 | self.factory.makeLiveFS(registrant=duplicate, owner=duplicate) |
2410 | @@ -619,14 +619,14 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2411 | def test_merge_with_duplicated_livefses(self): |
2412 | # If both the from and to people have live filesystems with the same |
2413 | # name, merging renames the duplicate from the from person's side. |
2414 | - self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"})) |
2415 | + self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"})) |
2416 | duplicate = self.factory.makePerson() |
2417 | mergee = self.factory.makePerson() |
2418 | self.factory.makeLiveFS( |
2419 | - registrant=duplicate, owner=duplicate, name=u'foo', |
2420 | + registrant=duplicate, owner=duplicate, name='foo', |
2421 | metadata={'project': 'FROM'}) |
2422 | self.factory.makeLiveFS( |
2423 | - registrant=mergee, owner=mergee, name=u'foo', |
2424 | + registrant=mergee, owner=mergee, name='foo', |
2425 | metadata={'project': 'TO'}) |
2426 | self._do_premerge(duplicate, mergee) |
2427 | login_person(mergee) |
2428 | @@ -635,7 +635,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2429 | self.assertEqual(2, livefses.count()) |
2430 | project_names = [livefs.metadata['project'] for livefs in livefses] |
2431 | self.assertEqual(['TO', 'FROM'], project_names) |
2432 | - self.assertEqual(u'foo-1', livefses[1].name) |
2433 | + self.assertEqual('foo-1', livefses[1].name) |
2434 | |
2435 | def test_merge_moves_snaps(self): |
2436 | # When person/teams are merged, snap packages owned by the from |
2437 | @@ -656,9 +656,9 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2438 | branch = self.factory.makeAnyBranch() |
2439 | [ref] = self.factory.makeGitRefs() |
2440 | self.factory.makeSnap( |
2441 | - registrant=duplicate, owner=duplicate, name=u'foo', branch=branch) |
2442 | + registrant=duplicate, owner=duplicate, name='foo', branch=branch) |
2443 | self.factory.makeSnap( |
2444 | - registrant=mergee, owner=mergee, name=u'foo', git_ref=ref) |
2445 | + registrant=mergee, owner=mergee, name='foo', git_ref=ref) |
2446 | self._do_premerge(duplicate, mergee) |
2447 | login_person(mergee) |
2448 | duplicate, mergee = self._do_merge(duplicate, mergee) |
2449 | @@ -668,11 +668,11 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2450 | self.assertIsNone(snaps[0].branch) |
2451 | self.assertEqual(ref.repository, snaps[0].git_repository) |
2452 | self.assertEqual(ref.path, snaps[0].git_path) |
2453 | - self.assertEqual(u'foo', snaps[0].name) |
2454 | + self.assertEqual('foo', snaps[0].name) |
2455 | self.assertEqual(branch, snaps[1].branch) |
2456 | self.assertIsNone(snaps[1].git_repository) |
2457 | self.assertIsNone(snaps[1].git_path) |
2458 | - self.assertEqual(u'foo-1', snaps[1].name) |
2459 | + self.assertEqual('foo-1', snaps[1].name) |
2460 | |
2461 | def test_merge_snapsubscription(self): |
2462 | # Checks that merging users moves subscriptions. |
2463 | @@ -681,7 +681,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2464 | mergee = self.factory.makePerson() |
2465 | snap = removeSecurityProxy(self.factory.makeSnap( |
2466 | owner=duplicate, registrant=duplicate, |
2467 | - name=u'foo', private=True)) |
2468 | + name='foo', private=True)) |
2469 | |
2470 | with admin_logged_in(): |
2471 | # Owner should have being subscribed automatically on creation. |
2472 | @@ -724,12 +724,12 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2473 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
2474 | duplicate = self.factory.makePerson() |
2475 | mergee = self.factory.makePerson() |
2476 | - [ref] = self.factory.makeGitRefs(paths=[u'refs/heads/v1.0-20.04']) |
2477 | - [ref2] = self.factory.makeGitRefs(paths=[u'refs/heads/v1.0-20.04']) |
2478 | + [ref] = self.factory.makeGitRefs(paths=['refs/heads/v1.0-20.04']) |
2479 | + [ref2] = self.factory.makeGitRefs(paths=['refs/heads/v1.0-20.04']) |
2480 | self.factory.makeOCIRecipe( |
2481 | - registrant=duplicate, owner=duplicate, name=u'foo', git_ref=ref) |
2482 | + registrant=duplicate, owner=duplicate, name='foo', git_ref=ref) |
2483 | self.factory.makeOCIRecipe( |
2484 | - registrant=mergee, owner=mergee, name=u'foo', git_ref=ref2) |
2485 | + registrant=mergee, owner=mergee, name='foo', git_ref=ref2) |
2486 | self._do_premerge(duplicate, mergee) |
2487 | login_person(mergee) |
2488 | duplicate, mergee = self._do_merge(duplicate, mergee) |
2489 | @@ -740,11 +740,11 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin): |
2490 | self.assertEqual(ref2, oci_recipes[0].git_ref) |
2491 | self.assertEqual(ref2.repository, oci_recipes[0].git_repository) |
2492 | self.assertEqual(ref2.path, oci_recipes[0].git_path) |
2493 | - self.assertEqual(u'foo', oci_recipes[0].name) |
2494 | + self.assertEqual('foo', oci_recipes[0].name) |
2495 | self.assertEqual(ref, oci_recipes[1].git_ref) |
2496 | self.assertEqual(ref.repository, oci_recipes[1].git_repository) |
2497 | self.assertEqual(ref.path, oci_recipes[1].git_path) |
2498 | - self.assertEqual(u'foo-1', oci_recipes[1].name) |
2499 | + self.assertEqual('foo-1', oci_recipes[1].name) |
2500 | |
2501 | def test_merge_moves_charm_recipes(self): |
2502 | # When person/teams are merged, charm recipes owned by the from |
2503 | diff --git a/lib/lp/registry/tests/test_personnotification.py b/lib/lp/registry/tests/test_personnotification.py |
2504 | index ce0df42..1f0854c 100644 |
2505 | --- a/lib/lp/registry/tests/test_personnotification.py |
2506 | +++ b/lib/lp/registry/tests/test_personnotification.py |
2507 | @@ -30,14 +30,14 @@ class TestPersonNotification(TestCaseWithFactory): |
2508 | layer = DatabaseFunctionalLayer |
2509 | |
2510 | def setUp(self): |
2511 | - super(TestPersonNotification, self).setUp() |
2512 | + super().setUp() |
2513 | self.notification_set = getUtility(IPersonNotificationSet) |
2514 | |
2515 | def test_to_addresses_user(self): |
2516 | # The to_addresses list is the user's preferred email address. |
2517 | user = self.factory.makePerson() |
2518 | notification = self.notification_set.addNotification( |
2519 | - user, u'subject', u'body') |
2520 | + user, 'subject', 'body') |
2521 | email = '%s <%s>' % ( |
2522 | user.displayname, removeSecurityProxy(user.preferredemail).email) |
2523 | self.assertEqual([email], notification.to_addresses) |
2524 | @@ -48,7 +48,7 @@ class TestPersonNotification(TestCaseWithFactory): |
2525 | user = self.factory.makePerson() |
2526 | user.setPreferredEmail(None) |
2527 | notification = self.notification_set.addNotification( |
2528 | - user, u'subject', u'body') |
2529 | + user, 'subject', 'body') |
2530 | self.assertEqual([], notification.to_addresses) |
2531 | self.assertFalse(notification.can_send) |
2532 | |
2533 | @@ -56,7 +56,7 @@ class TestPersonNotification(TestCaseWithFactory): |
2534 | # The to_addresses list is the team admin addresses. |
2535 | team = self.factory.makeTeam() |
2536 | notification = self.notification_set.addNotification( |
2537 | - team, u'subject', u'body') |
2538 | + team, 'subject', 'body') |
2539 | email = removeSecurityProxy(team.teamowner.preferredemail).email |
2540 | self.assertEqual([email], notification.to_addresses) |
2541 | self.assertTrue(notification.can_send) |
2542 | @@ -68,20 +68,20 @@ class TestPersonNotificationManager(TestCaseWithFactory): |
2543 | layer = DatabaseFunctionalLayer |
2544 | |
2545 | def setUp(self): |
2546 | - super(TestPersonNotificationManager, self).setUp() |
2547 | + super().setUp() |
2548 | logging.basicConfig(level=logging.CRITICAL) |
2549 | logger = logging.getLogger() |
2550 | self.manager = PersonNotificationManager(transaction, logger) |
2551 | self.notification_set = getUtility(IPersonNotificationSet) |
2552 | |
2553 | def tearDown(self): |
2554 | - super(TestPersonNotificationManager, self).tearDown() |
2555 | + super().tearDown() |
2556 | reset_logging() |
2557 | |
2558 | def test_sendNotifications_sent(self): |
2559 | user = self.factory.makePerson() |
2560 | notification = self.notification_set.addNotification( |
2561 | - user, u'subject', u'body') |
2562 | + user, 'subject', 'body') |
2563 | unsent = self.manager.sendNotifications() |
2564 | self.assertEqual(None, unsent) |
2565 | self.assertIsNotNone(notification.date_emailed) |
2566 | @@ -89,7 +89,7 @@ class TestPersonNotificationManager(TestCaseWithFactory): |
2567 | def test_sendNotifications_unsent(self): |
2568 | user = self.factory.makePerson() |
2569 | notification = self.notification_set.addNotification( |
2570 | - user, u'subject', u'body') |
2571 | + user, 'subject', 'body') |
2572 | user.setPreferredEmail(None) |
2573 | unsent = self.manager.sendNotifications() |
2574 | self.assertEqual([notification], unsent) |
2575 | @@ -99,7 +99,7 @@ class TestPersonNotificationManager(TestCaseWithFactory): |
2576 | team = self.factory.makeTeam() |
2577 | self.assertIs(None, team.preferredemail) |
2578 | notification = self.notification_set.addNotification( |
2579 | - team, u'subject', u'body') |
2580 | + team, 'subject', 'body') |
2581 | unsent = self.manager.sendNotifications() |
2582 | self.assertEqual(None, unsent) |
2583 | self.assertIsNotNone(notification.date_emailed) |
2584 | @@ -107,7 +107,7 @@ class TestPersonNotificationManager(TestCaseWithFactory): |
2585 | def test_purgeNotifications_old(self): |
2586 | user = self.factory.makePerson() |
2587 | notification = self.notification_set.addNotification( |
2588 | - user, u'subject', u'body') |
2589 | + user, 'subject', 'body') |
2590 | age = timedelta( |
2591 | days=int(config.person_notification.retained_days) + 1) |
2592 | naked_notification = removeSecurityProxy(notification) |
2593 | @@ -120,7 +120,7 @@ class TestPersonNotificationManager(TestCaseWithFactory): |
2594 | def test_purgeNotifications_extra(self): |
2595 | user = self.factory.makePerson() |
2596 | notification = self.notification_set.addNotification( |
2597 | - user, u'subject', u'body') |
2598 | + user, 'subject', 'body') |
2599 | user.setPreferredEmail(None) |
2600 | self.manager.purgeNotifications(extra_notifications=[notification]) |
2601 | notifcations = self.notification_set.getNotificationsToSend() |
2602 | diff --git a/lib/lp/registry/tests/test_personroles.py b/lib/lp/registry/tests/test_personroles.py |
2603 | index 8ebb402..0bddc7a 100644 |
2604 | --- a/lib/lp/registry/tests/test_personroles.py |
2605 | +++ b/lib/lp/registry/tests/test_personroles.py |
2606 | @@ -21,7 +21,7 @@ class TestPersonRoles(TestCaseWithFactory): |
2607 | prefix = 'in_' |
2608 | |
2609 | def setUp(self): |
2610 | - super(TestPersonRoles, self).setUp() |
2611 | + super().setUp() |
2612 | self.person = self.factory.makePerson() |
2613 | self.celebs = getUtility(ILaunchpadCelebrities) |
2614 | |
2615 | diff --git a/lib/lp/registry/tests/test_personset.py b/lib/lp/registry/tests/test_personset.py |
2616 | index cccc95d..3137f94 100644 |
2617 | --- a/lib/lp/registry/tests/test_personset.py |
2618 | +++ b/lib/lp/registry/tests/test_personset.py |
2619 | @@ -105,7 +105,7 @@ class TestPersonSet(TestCaseWithFactory): |
2620 | layer = DatabaseFunctionalLayer |
2621 | |
2622 | def setUp(self): |
2623 | - super(TestPersonSet, self).setUp() |
2624 | + super().setUp() |
2625 | login(ANONYMOUS) |
2626 | self.addCleanup(logout) |
2627 | self.person_set = getUtility(IPersonSet) |
2628 | @@ -119,7 +119,7 @@ class TestPersonSet(TestCaseWithFactory): |
2629 | def test_isNameBlacklisted_user_is_admin(self): |
2630 | team = self.factory.makeTeam() |
2631 | name_blacklist_set = getUtility(INameBlacklistSet) |
2632 | - self.admin_exp = name_blacklist_set.create(u'fnord', admin=team) |
2633 | + self.admin_exp = name_blacklist_set.create('fnord', admin=team) |
2634 | self.store = IStore(self.admin_exp) |
2635 | self.store.flush() |
2636 | user = team.teamowner |
2637 | @@ -177,7 +177,7 @@ class TestPersonSet(TestCaseWithFactory): |
2638 | # getPrecachedPersonsFromIDs() sets preferredemail to the preferred |
2639 | # address if it exists, but otherwise leaves it as none. |
2640 | team_no_contact = self.factory.makeTeam(email=None) |
2641 | - team_contact = self.factory.makeTeam(email=u'team@example.com') |
2642 | + team_contact = self.factory.makeTeam(email='team@example.com') |
2643 | team_list = self.factory.makeTeam(email=None) |
2644 | self.factory.makeMailingList(team_list, team_list.teamowner) |
2645 | person_normal = self.factory.makePerson() |
2646 | @@ -228,9 +228,9 @@ class TestPersonSet(TestCaseWithFactory): |
2647 | with person_logged_in(person): |
2648 | identifier = person.account.openid_identifiers.one().identifier |
2649 | for id_url in ( |
2650 | - u'http://testopenid.test/+id/%s' % identifier, |
2651 | - u'http://login1.test/+id/%s' % identifier, |
2652 | - u'http://login2.test/+id/%s' % identifier): |
2653 | + 'http://testopenid.test/+id/%s' % identifier, |
2654 | + 'http://login1.test/+id/%s' % identifier, |
2655 | + 'http://login2.test/+id/%s' % identifier): |
2656 | self.assertEqual( |
2657 | person, self.person_set.getByOpenIDIdentifier(id_url)) |
2658 | |
2659 | @@ -239,7 +239,7 @@ class TestPersonSet(TestCaseWithFactory): |
2660 | self.assertIs( |
2661 | None, |
2662 | self.person_set.getByOpenIDIdentifier( |
2663 | - u'http://testopenid.test/+id/notanid')) |
2664 | + 'http://testopenid.test/+id/notanid')) |
2665 | |
2666 | def test_getByOpenIDIdentifier_for_bad_domain_is_none(self): |
2667 | # Even though the OpenIDIdentifier table doesn't store the |
2668 | @@ -251,13 +251,13 @@ class TestPersonSet(TestCaseWithFactory): |
2669 | self.assertIs( |
2670 | None, |
2671 | self.person_set.getByOpenIDIdentifier( |
2672 | - u'http://not.launchpad.test/+id/%s' % identifier)) |
2673 | + 'http://not.launchpad.test/+id/%s' % identifier)) |
2674 | |
2675 | def test_find__accepts_queries_with_or_operator(self): |
2676 | # PersonSet.find() allows to search for OR combined terms. |
2677 | person_one = self.factory.makePerson(name='baz') |
2678 | person_two = self.factory.makeTeam(name='blah') |
2679 | - result = list(self.person_set.find(u'baz OR blah')) |
2680 | + result = list(self.person_set.find('baz OR blah')) |
2681 | self.assertEqual([person_one, person_two], result) |
2682 | |
2683 | def test_findPerson__accepts_queries_with_or_operator(self): |
2684 | @@ -266,11 +266,11 @@ class TestPersonSet(TestCaseWithFactory): |
2685 | name='baz', email='one@example.org') |
2686 | person_two = self.factory.makePerson( |
2687 | name='blah', email='two@example.com') |
2688 | - result = list(self.person_set.findPerson(u'baz OR blah')) |
2689 | + result = list(self.person_set.findPerson('baz OR blah')) |
2690 | self.assertEqual([person_one, person_two], result) |
2691 | # Note that these OR searches do not work for email addresses. |
2692 | result = list(self.person_set.findPerson( |
2693 | - u'one@example.org OR two@example.org')) |
2694 | + 'one@example.org OR two@example.org')) |
2695 | self.assertEqual([], result) |
2696 | |
2697 | def test_findPerson__case_insensitive_email_address_search(self): |
2698 | @@ -279,29 +279,29 @@ class TestPersonSet(TestCaseWithFactory): |
2699 | name='baz', email='ONE@example.org') |
2700 | person_two = self.factory.makePerson( |
2701 | name='blah', email='two@example.com') |
2702 | - result = list(self.person_set.findPerson(u'one@example.org')) |
2703 | + result = list(self.person_set.findPerson('one@example.org')) |
2704 | self.assertEqual([person_one], result) |
2705 | - result = list(self.person_set.findPerson(u'TWO@example.com')) |
2706 | + result = list(self.person_set.findPerson('TWO@example.com')) |
2707 | self.assertEqual([person_two], result) |
2708 | |
2709 | def test_findTeam__accepts_queries_with_or_operator(self): |
2710 | # PersonSet.findTeam() allows to search for OR combined terms. |
2711 | team_one = self.factory.makeTeam(name='baz', email='ONE@example.org') |
2712 | team_two = self.factory.makeTeam(name='blah', email='TWO@example.com') |
2713 | - result = list(self.person_set.findTeam(u'baz OR blah')) |
2714 | + result = list(self.person_set.findTeam('baz OR blah')) |
2715 | self.assertEqual([team_one, team_two], result) |
2716 | # Note that these OR searches do not work for email addresses. |
2717 | result = list(self.person_set.findTeam( |
2718 | - u'one@example.org OR two@example.org')) |
2719 | + 'one@example.org OR two@example.org')) |
2720 | self.assertEqual([], result) |
2721 | |
2722 | def test_findTeam__case_insensitive_email_address_search(self): |
2723 | # A search for email addresses is case insensitve. |
2724 | team_one = self.factory.makeTeam(name='baz', email='ONE@example.org') |
2725 | team_two = self.factory.makeTeam(name='blah', email='TWO@example.com') |
2726 | - result = list(self.person_set.findTeam(u'one@example.org')) |
2727 | + result = list(self.person_set.findTeam('one@example.org')) |
2728 | self.assertEqual([team_one], result) |
2729 | - result = list(self.person_set.findTeam(u'TWO@example.com')) |
2730 | + result = list(self.person_set.findTeam('TWO@example.com')) |
2731 | self.assertEqual([team_two], result) |
2732 | |
2733 | |
2734 | @@ -309,13 +309,13 @@ class TestPersonSetCreateByOpenId(TestCaseWithFactory): |
2735 | layer = DatabaseFunctionalLayer |
2736 | |
2737 | def setUp(self): |
2738 | - super(TestPersonSetCreateByOpenId, self).setUp() |
2739 | + super().setUp() |
2740 | self.person_set = getUtility(IPersonSet) |
2741 | self.store = IMasterStore(Account) |
2742 | |
2743 | # Generate some valid test data. |
2744 | self.account = self.makeAccount() |
2745 | - self.identifier = make_openid_identifier(self.account, u'whatever') |
2746 | + self.identifier = make_openid_identifier(self.account, 'whatever') |
2747 | self.person = self.makePerson(self.account) |
2748 | self.email = self.makeEmailAddress( |
2749 | email='whatever@example.com', person=self.person) |
2750 | @@ -374,7 +374,7 @@ class TestPersonSetCreateByOpenId(TestCaseWithFactory): |
2751 | def testNewOpenId(self): |
2752 | # Account looked up by email and the new OpenId identifier |
2753 | # attached. We can do this because we trust our OpenId Provider. |
2754 | - new_identifier = u'newident' |
2755 | + new_identifier = 'newident' |
2756 | found, updated = self.person_set.getOrCreateByOpenIDIdentifier( |
2757 | new_identifier, self.email.email, 'Ignored Name', |
2758 | PersonCreationRationale.UNKNOWN, 'No Comment') |
2759 | @@ -399,8 +399,8 @@ class TestPersonSetCreateByOpenId(TestCaseWithFactory): |
2760 | def testNewAccountAndIdentifier(self): |
2761 | # If neither the OpenId Identifier nor the email address are |
2762 | # found, we create everything. |
2763 | - new_email = u'new_email@example.com' |
2764 | - new_identifier = u'new_identifier' |
2765 | + new_email = 'new_email@example.com' |
2766 | + new_identifier = 'new_identifier' |
2767 | found, updated = self.person_set.getOrCreateByOpenIDIdentifier( |
2768 | new_identifier, new_email, 'New Name', |
2769 | PersonCreationRationale.UNKNOWN, 'No Comment') |
2770 | @@ -422,7 +422,7 @@ class TestPersonSetCreateByOpenId(TestCaseWithFactory): |
2771 | self.email.account = None |
2772 | self.email.status = EmailAddressStatus.NEW |
2773 | self.person.account = None |
2774 | - new_identifier = u'new_identifier' |
2775 | + new_identifier = 'new_identifier' |
2776 | found, updated = self.person_set.getOrCreateByOpenIDIdentifier( |
2777 | new_identifier, self.email.email, 'Ignored', |
2778 | PersonCreationRationale.UNKNOWN, 'No Comment') |
2779 | @@ -459,7 +459,7 @@ class TestPersonSetCreateByOpenId(TestCaseWithFactory): |
2780 | def testEmptyOpenIDIdentifier(self): |
2781 | self.assertRaises( |
2782 | AssertionError, |
2783 | - self.person_set.getOrCreateByOpenIDIdentifier, u'', 'foo@bar.com', |
2784 | + self.person_set.getOrCreateByOpenIDIdentifier, '', 'foo@bar.com', |
2785 | 'New Name', PersonCreationRationale.UNKNOWN, 'No Comment') |
2786 | |
2787 | def testTeamEmailAddress(self): |
2788 | @@ -471,7 +471,7 @@ class TestPersonSetCreateByOpenId(TestCaseWithFactory): |
2789 | self.assertRaises( |
2790 | TeamEmailAddressError, |
2791 | self.person_set.getOrCreateByOpenIDIdentifier, |
2792 | - u'other-openid-identifier', 'foo@bar.com', 'New Name', |
2793 | + 'other-openid-identifier', 'foo@bar.com', 'New Name', |
2794 | PersonCreationRationale.UNKNOWN, 'No Comment') |
2795 | |
2796 | def testDeactivatedAccount(self): |
2797 | @@ -491,9 +491,9 @@ class TestPersonSetCreateByOpenId(TestCaseWithFactory): |
2798 | def testPlaceholderAccount(self): |
2799 | # Logging into a username placeholder account activates the |
2800 | # account and adds the email address. |
2801 | - email = u'placeholder@example.com' |
2802 | - openid = u'placeholder-id' |
2803 | - name = u'placeholder' |
2804 | + email = 'placeholder@example.com' |
2805 | + openid = 'placeholder-id' |
2806 | + name = 'placeholder' |
2807 | person = self.person_set.createPlaceholderPerson(openid, name) |
2808 | self.assertEqual(AccountStatus.PLACEHOLDER, person.account.status) |
2809 | original_created = person.datecreated |
2810 | @@ -609,7 +609,7 @@ class TestPersonSetGetOrCreateByOpenIDIdentifier(TestCaseWithFactory): |
2811 | layer = DatabaseFunctionalLayer |
2812 | |
2813 | def setUp(self): |
2814 | - super(TestPersonSetGetOrCreateByOpenIDIdentifier, self).setUp() |
2815 | + super().setUp() |
2816 | self.person_set = getUtility(IPersonSet) |
2817 | |
2818 | def callGetOrCreate(self, identifier, email='a@b.com'): |
2819 | @@ -668,10 +668,10 @@ class TestPersonSetGetOrCreateByOpenIDIdentifier(TestCaseWithFactory): |
2820 | def test_no_account_or_email(self): |
2821 | # An identifier can be used to create an account (it is assumed |
2822 | # to be already authenticated with SSO). |
2823 | - person, db_updated = self.callGetOrCreate(u'openid-identifier') |
2824 | + person, db_updated = self.callGetOrCreate('openid-identifier') |
2825 | |
2826 | self.assertEqual( |
2827 | - u"openid-identifier", removeSecurityProxy( |
2828 | + "openid-identifier", removeSecurityProxy( |
2829 | person.account).openid_identifiers.any().identifier) |
2830 | self.assertTrue(db_updated) |
2831 | |
2832 | @@ -681,11 +681,11 @@ class TestPersonSetGetOrCreateByOpenIDIdentifier(TestCaseWithFactory): |
2833 | other_person = self.factory.makePerson('a@b.com') |
2834 | |
2835 | person, db_updated = self.callGetOrCreate( |
2836 | - u'other-openid-identifier', 'a@b.com') |
2837 | + 'other-openid-identifier', 'a@b.com') |
2838 | |
2839 | self.assertEqual(other_person, person) |
2840 | self.assertIn( |
2841 | - u'other-openid-identifier', |
2842 | + 'other-openid-identifier', |
2843 | [identifier.identifier for identifier in removeSecurityProxy( |
2844 | person.account).openid_identifiers]) |
2845 | |
2846 | @@ -695,7 +695,7 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory): |
2847 | layer = DatabaseFunctionalLayer |
2848 | |
2849 | def setUp(self): |
2850 | - super(TestPersonSetGetOrCreateSoftwareCenterCustomer, self).setUp() |
2851 | + super().setUp() |
2852 | self.sca = getUtility(IPersonSet).getByName('software-center-agent') |
2853 | |
2854 | def test_restricted_to_sca(self): |
2855 | @@ -703,7 +703,7 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory): |
2856 | # privileged method. |
2857 | def do_it(): |
2858 | return getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer( |
2859 | - getUtility(ILaunchBag).user, u'somebody', |
2860 | + getUtility(ILaunchBag).user, 'somebody', |
2861 | 'somebody@example.com', 'Example') |
2862 | random = self.factory.makePerson() |
2863 | admin = self.factory.makePerson( |
2864 | @@ -724,10 +724,10 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory): |
2865 | def test_finds_by_openid(self): |
2866 | # A Person with the requested OpenID identifier is returned. |
2867 | somebody = self.factory.makePerson() |
2868 | - make_openid_identifier(somebody.account, u'somebody') |
2869 | + make_openid_identifier(somebody.account, 'somebody') |
2870 | with person_logged_in(self.sca): |
2871 | got = getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer( |
2872 | - self.sca, u'somebody', 'somebody@example.com', 'Example') |
2873 | + self.sca, 'somebody', 'somebody@example.com', 'Example') |
2874 | self.assertEqual(somebody, got) |
2875 | |
2876 | # The email address doesn't get linked, as that could change how |
2877 | @@ -741,7 +741,7 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory): |
2878 | # provided, a new account is created and returned. |
2879 | with person_logged_in(self.sca): |
2880 | made = getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer( |
2881 | - self.sca, u'somebody', 'somebody@example.com', 'Example') |
2882 | + self.sca, 'somebody', 'somebody@example.com', 'Example') |
2883 | with admin_logged_in(): |
2884 | self.assertEqual('Example', made.displayname) |
2885 | self.assertEqual('somebody@example.com', made.preferredemail.email) |
2886 | @@ -757,11 +757,11 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory): |
2887 | somebody = self.factory.makePerson( |
2888 | email='existing@example.com', |
2889 | account_status=AccountStatus.NOACCOUNT) |
2890 | - make_openid_identifier(somebody.account, u'somebody') |
2891 | + make_openid_identifier(somebody.account, 'somebody') |
2892 | self.assertEqual(AccountStatus.NOACCOUNT, somebody.account.status) |
2893 | with person_logged_in(self.sca): |
2894 | got = getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer( |
2895 | - self.sca, u'somebody', 'somebody@example.com', 'Example') |
2896 | + self.sca, 'somebody', 'somebody@example.com', 'Example') |
2897 | self.assertEqual(somebody, got) |
2898 | with admin_logged_in(): |
2899 | self.assertEqual(AccountStatus.ACTIVE, somebody.account.status) |
2900 | @@ -781,7 +781,7 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory): |
2901 | self.assertRaises( |
2902 | EmailAddressAlreadyTaken, |
2903 | getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer, |
2904 | - self.sca, u'somebody', 'other@example.com', 'Example') |
2905 | + self.sca, 'somebody', 'other@example.com', 'Example') |
2906 | |
2907 | # The email address stays with the old owner. |
2908 | email = getUtility(IEmailAddressSet).getByEmail('other@example.com') |
2909 | @@ -790,7 +790,7 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory): |
2910 | def test_fails_if_account_is_suspended(self): |
2911 | # Suspended accounts cannot be returned. |
2912 | somebody = self.factory.makePerson() |
2913 | - make_openid_identifier(somebody.account, u'somebody') |
2914 | + make_openid_identifier(somebody.account, 'somebody') |
2915 | with admin_logged_in(): |
2916 | somebody.setAccountStatus( |
2917 | AccountStatus.SUSPENDED, None, "Go away!") |
2918 | @@ -798,14 +798,14 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory): |
2919 | self.assertRaises( |
2920 | AccountSuspendedError, |
2921 | getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer, |
2922 | - self.sca, u'somebody', 'somebody@example.com', 'Example') |
2923 | + self.sca, 'somebody', 'somebody@example.com', 'Example') |
2924 | |
2925 | def test_fails_if_account_is_deactivated(self): |
2926 | # We don't want to reactivate explicitly deactivated accounts, |
2927 | # nor do we want to potentially compromise them with a bad email |
2928 | # address. |
2929 | somebody = self.factory.makePerson() |
2930 | - make_openid_identifier(somebody.account, u'somebody') |
2931 | + make_openid_identifier(somebody.account, 'somebody') |
2932 | with admin_logged_in(): |
2933 | somebody.setAccountStatus( |
2934 | AccountStatus.DEACTIVATED, None, "Goodbye cruel world.") |
2935 | @@ -813,19 +813,19 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory): |
2936 | self.assertRaises( |
2937 | NameAlreadyTaken, |
2938 | getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer, |
2939 | - self.sca, u'somebody', 'somebody@example.com', 'Example') |
2940 | + self.sca, 'somebody', 'somebody@example.com', 'Example') |
2941 | |
2942 | def test_fails_if_account_is_deceased(self): |
2943 | # Accounts belonging to deceased users cannot be returned. |
2944 | somebody = self.factory.makePerson() |
2945 | - make_openid_identifier(somebody.account, u'somebody') |
2946 | + make_openid_identifier(somebody.account, 'somebody') |
2947 | with admin_logged_in(): |
2948 | somebody.setAccountStatus(AccountStatus.DECEASED, None, "RIP") |
2949 | with person_logged_in(self.sca): |
2950 | self.assertRaises( |
2951 | AccountDeceasedError, |
2952 | getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer, |
2953 | - self.sca, u'somebody', 'somebody@example.com', 'Example') |
2954 | + self.sca, 'somebody', 'somebody@example.com', 'Example') |
2955 | |
2956 | |
2957 | class TestPersonGetUsernameForSSO(TestCaseWithFactory): |
2958 | @@ -833,21 +833,21 @@ class TestPersonGetUsernameForSSO(TestCaseWithFactory): |
2959 | layer = DatabaseFunctionalLayer |
2960 | |
2961 | def setUp(self): |
2962 | - super(TestPersonGetUsernameForSSO, self).setUp() |
2963 | - self.sso = getUtility(IPersonSet).getByName(u'ubuntu-sso') |
2964 | + super().setUp() |
2965 | + self.sso = getUtility(IPersonSet).getByName('ubuntu-sso') |
2966 | |
2967 | def test_restricted_to_sca(self): |
2968 | # Only the ubuntu-sso celebrity can invoke this |
2969 | # privileged method. |
2970 | target = self.factory.makePerson(name='username') |
2971 | - make_openid_identifier(target.account, u'openid') |
2972 | + make_openid_identifier(target.account, 'openid') |
2973 | |
2974 | def do_it(): |
2975 | return getUtility(IPersonSet).getUsernameForSSO( |
2976 | - getUtility(ILaunchBag).user, u'openid') |
2977 | + getUtility(ILaunchBag).user, 'openid') |
2978 | random = self.factory.makePerson() |
2979 | admin = self.factory.makePerson( |
2980 | - member_of=[getUtility(IPersonSet).getByName(u'admins')]) |
2981 | + member_of=[getUtility(IPersonSet).getByName('admins')]) |
2982 | |
2983 | # Anonymous, random or admin users can't invoke the method. |
2984 | with anonymous_logged_in(): |
2985 | @@ -866,18 +866,18 @@ class TestPersonSetUsernameFromSSO(TestCaseWithFactory): |
2986 | layer = DatabaseFunctionalLayer |
2987 | |
2988 | def setUp(self): |
2989 | - super(TestPersonSetUsernameFromSSO, self).setUp() |
2990 | - self.sso = getUtility(IPersonSet).getByName(u'ubuntu-sso') |
2991 | + super().setUp() |
2992 | + self.sso = getUtility(IPersonSet).getByName('ubuntu-sso') |
2993 | |
2994 | def test_restricted_to_sca(self): |
2995 | # Only the ubuntu-sso celebrity can invoke this |
2996 | # privileged method. |
2997 | def do_it(): |
2998 | getUtility(IPersonSet).setUsernameFromSSO( |
2999 | - getUtility(ILaunchBag).user, u'openid', u'username') |
3000 | + getUtility(ILaunchBag).user, 'openid', 'username') |
3001 | random = self.factory.makePerson() |
3002 | admin = self.factory.makePerson( |
3003 | - member_of=[getUtility(IPersonSet).getByName(u'admins')]) |
3004 | + member_of=[getUtility(IPersonSet).getByName('admins')]) |
3005 | |
3006 | # Anonymous, random or admin users can't invoke the method. |
3007 | with anonymous_logged_in(): |
3008 | @@ -896,14 +896,14 @@ class TestPersonSetUsernameFromSSO(TestCaseWithFactory): |
3009 | # returned. |
3010 | with person_logged_in(self.sso): |
3011 | getUtility(IPersonSet).setUsernameFromSSO( |
3012 | - self.sso, u'openid', u'username') |
3013 | - person = getUtility(IPersonSet).getByName(u'username') |
3014 | - self.assertEqual(u'username', person.name) |
3015 | - self.assertEqual(u'username', person.displayname) |
3016 | + self.sso, 'openid', 'username') |
3017 | + person = getUtility(IPersonSet).getByName('username') |
3018 | + self.assertEqual('username', person.name) |
3019 | + self.assertEqual('username', person.displayname) |
3020 | self.assertEqual(AccountStatus.PLACEHOLDER, person.account.status) |
3021 | with admin_logged_in(): |
3022 | self.assertContentEqual( |
3023 | - [u'openid'], |
3024 | + ['openid'], |
3025 | [oid.identifier for oid in person.account.openid_identifiers]) |
3026 | self.assertContentEqual([], person.validatedemails) |
3027 | self.assertContentEqual([], person.guessedemails) |
3028 | @@ -911,25 +911,25 @@ class TestPersonSetUsernameFromSSO(TestCaseWithFactory): |
3029 | def test_creates_new_placeholder_dry_run(self): |
3030 | with person_logged_in(self.sso): |
3031 | getUtility(IPersonSet).setUsernameFromSSO( |
3032 | - self.sso, u'openid', u'username', dry_run=True) |
3033 | + self.sso, 'openid', 'username', dry_run=True) |
3034 | self.assertRaises( |
3035 | LookupError, |
3036 | - getUtility(IAccountSet).getByOpenIDIdentifier, u'openid') |
3037 | - self.assertIs(None, getUtility(IPersonSet).getByName(u'username')) |
3038 | + getUtility(IAccountSet).getByOpenIDIdentifier, 'openid') |
3039 | + self.assertIs(None, getUtility(IPersonSet).getByName('username')) |
3040 | |
3041 | def test_updates_existing_placeholder(self): |
3042 | # An existing placeholder Person with the request OpenID |
3043 | # identifier has its name updated. |
3044 | getUtility(IPersonSet).setUsernameFromSSO( |
3045 | - self.sso, u'openid', u'username') |
3046 | - person = getUtility(IPersonSet).getByName(u'username') |
3047 | + self.sso, 'openid', 'username') |
3048 | + person = getUtility(IPersonSet).getByName('username') |
3049 | |
3050 | # Another call for the same OpenID identifier updates the |
3051 | # existing Person. |
3052 | getUtility(IPersonSet).setUsernameFromSSO( |
3053 | - self.sso, u'openid', u'newsername') |
3054 | - self.assertEqual(u'newsername', person.name) |
3055 | - self.assertEqual(u'newsername', person.displayname) |
3056 | + self.sso, 'openid', 'newsername') |
3057 | + self.assertEqual('newsername', person.name) |
3058 | + self.assertEqual('newsername', person.displayname) |
3059 | self.assertEqual(AccountStatus.PLACEHOLDER, person.account.status) |
3060 | with admin_logged_in(): |
3061 | self.assertContentEqual([], person.validatedemails) |
3062 | @@ -937,19 +937,19 @@ class TestPersonSetUsernameFromSSO(TestCaseWithFactory): |
3063 | |
3064 | def test_updates_existing_placeholder_dry_run(self): |
3065 | getUtility(IPersonSet).setUsernameFromSSO( |
3066 | - self.sso, u'openid', u'username') |
3067 | - person = getUtility(IPersonSet).getByName(u'username') |
3068 | + self.sso, 'openid', 'username') |
3069 | + person = getUtility(IPersonSet).getByName('username') |
3070 | |
3071 | getUtility(IPersonSet).setUsernameFromSSO( |
3072 | - self.sso, u'openid', u'newsername', dry_run=True) |
3073 | - self.assertEqual(u'username', person.name) |
3074 | + self.sso, 'openid', 'newsername', dry_run=True) |
3075 | + self.assertEqual('username', person.name) |
3076 | |
3077 | def test_validation(self, dry_run=False): |
3078 | # An invalid username is rejected with an InvalidName exception. |
3079 | self.assertRaises( |
3080 | InvalidName, |
3081 | getUtility(IPersonSet).setUsernameFromSSO, |
3082 | - self.sso, u'openid', u'username!!', dry_run=dry_run) |
3083 | + self.sso, 'openid', 'username!!', dry_run=dry_run) |
3084 | transaction.abort() |
3085 | |
3086 | # A username that's already in use is rejected with a |
3087 | @@ -958,17 +958,17 @@ class TestPersonSetUsernameFromSSO(TestCaseWithFactory): |
3088 | self.assertRaises( |
3089 | NameAlreadyTaken, |
3090 | getUtility(IPersonSet).setUsernameFromSSO, |
3091 | - self.sso, u'openid', u'taken', dry_run=dry_run) |
3092 | + self.sso, 'openid', 'taken', dry_run=dry_run) |
3093 | transaction.abort() |
3094 | |
3095 | # setUsernameFromSSO can't be used to set an OpenID |
3096 | # identifier's username if a non-placeholder account exists. |
3097 | somebody = self.factory.makePerson() |
3098 | - make_openid_identifier(somebody.account, u'openid-taken') |
3099 | + make_openid_identifier(somebody.account, 'openid-taken') |
3100 | self.assertRaises( |
3101 | NotPlaceholderAccount, |
3102 | getUtility(IPersonSet).setUsernameFromSSO, |
3103 | - self.sso, u'openid-taken', u'username', dry_run=dry_run) |
3104 | + self.sso, 'openid-taken', 'username', dry_run=dry_run) |
3105 | |
3106 | def test_validation_dry_run(self): |
3107 | self.test_validation(dry_run=True) |
3108 | @@ -979,21 +979,21 @@ class TestPersonGetSSHKeysForSSO(TestCaseWithFactory): |
3109 | layer = DatabaseFunctionalLayer |
3110 | |
3111 | def setUp(self): |
3112 | - super(TestPersonGetSSHKeysForSSO, self).setUp() |
3113 | - self.sso = getUtility(IPersonSet).getByName(u'ubuntu-sso') |
3114 | + super().setUp() |
3115 | + self.sso = getUtility(IPersonSet).getByName('ubuntu-sso') |
3116 | |
3117 | def test_restricted_to_sso(self): |
3118 | # Only the ubuntu-sso celebrity can invoke this |
3119 | # privileged method. |
3120 | target = self.factory.makePerson(name='username') |
3121 | - make_openid_identifier(target.account, u'openid') |
3122 | + make_openid_identifier(target.account, 'openid') |
3123 | |
3124 | def do_it(): |
3125 | return getUtility(IPersonSet).getUsernameForSSO( |
3126 | - getUtility(ILaunchBag).user, u'openid') |
3127 | + getUtility(ILaunchBag).user, 'openid') |
3128 | random = self.factory.makePerson() |
3129 | admin = self.factory.makePerson( |
3130 | - member_of=[getUtility(IPersonSet).getByName(u'admins')]) |
3131 | + member_of=[getUtility(IPersonSet).getByName('admins')]) |
3132 | |
3133 | # Anonymous, random or admin users can't invoke the method. |
3134 | with anonymous_logged_in(): |
3135 | @@ -1011,22 +1011,22 @@ class TestPersonAddSSHKeyFromSSO(TestCaseWithFactory): |
3136 | layer = DatabaseFunctionalLayer |
3137 | |
3138 | def setUp(self): |
3139 | - super(TestPersonAddSSHKeyFromSSO, self).setUp() |
3140 | - self.sso = getUtility(IPersonSet).getByName(u'ubuntu-sso') |
3141 | + super().setUp() |
3142 | + self.sso = getUtility(IPersonSet).getByName('ubuntu-sso') |
3143 | |
3144 | def test_restricted_to_sso(self): |
3145 | # Only the ubuntu-sso celebrity can invoke this |
3146 | # privileged method. |
3147 | key_text = self.factory.makeSSHKeyText() |
3148 | target = self.factory.makePerson(name='username') |
3149 | - make_openid_identifier(target.account, u'openid') |
3150 | + make_openid_identifier(target.account, 'openid') |
3151 | |
3152 | def do_it(): |
3153 | return getUtility(IPersonSet).addSSHKeyFromSSO( |
3154 | - getUtility(ILaunchBag).user, u'openid', key_text, False) |
3155 | + getUtility(ILaunchBag).user, 'openid', key_text, False) |
3156 | random = self.factory.makePerson() |
3157 | admin = self.factory.makePerson( |
3158 | - member_of=[getUtility(IPersonSet).getByName(u'admins')]) |
3159 | + member_of=[getUtility(IPersonSet).getByName('admins')]) |
3160 | |
3161 | # Anonymous, random or admin users can't invoke the method. |
3162 | with anonymous_logged_in(): |
3163 | @@ -1042,11 +1042,11 @@ class TestPersonAddSSHKeyFromSSO(TestCaseWithFactory): |
3164 | full_key = self.factory.makeSSHKeyText() |
3165 | _, keytext, comment = full_key.split(' ', 2) |
3166 | target = self.factory.makePerson(name='username') |
3167 | - make_openid_identifier(target.account, u'openid') |
3168 | + make_openid_identifier(target.account, 'openid') |
3169 | |
3170 | with person_logged_in(self.sso): |
3171 | getUtility(IPersonSet).addSSHKeyFromSSO( |
3172 | - self.sso, u'openid', full_key, False) |
3173 | + self.sso, 'openid', full_key, False) |
3174 | |
3175 | with person_logged_in(target): |
3176 | [key] = target.sshkeys |
3177 | @@ -1057,11 +1057,11 @@ class TestPersonAddSSHKeyFromSSO(TestCaseWithFactory): |
3178 | def test_does_not_add_new_ssh_key_with_dry_run(self): |
3179 | key_text = self.factory.makeSSHKeyText() |
3180 | target = self.factory.makePerson(name='username') |
3181 | - make_openid_identifier(target.account, u'openid') |
3182 | + make_openid_identifier(target.account, 'openid') |
3183 | |
3184 | with person_logged_in(self.sso): |
3185 | getUtility(IPersonSet).addSSHKeyFromSSO( |
3186 | - self.sso, u'openid', key_text, True) |
3187 | + self.sso, 'openid', key_text, True) |
3188 | |
3189 | with person_logged_in(target): |
3190 | self.assertEqual(0, target.sshkeys.count()) |
3191 | @@ -1071,7 +1071,7 @@ class TestPersonAddSSHKeyFromSSO(TestCaseWithFactory): |
3192 | self.assertRaises( |
3193 | NoSuchAccount, |
3194 | getUtility(IPersonSet).addSSHKeyFromSSO, |
3195 | - self.sso, u'doesnotexist', 'ssh-rsa key comment', True) |
3196 | + self.sso, 'doesnotexist', 'ssh-rsa key comment', True) |
3197 | |
3198 | |
3199 | class TestPersonDeleteSSHKeyFromSSO(TestCaseWithFactory): |
3200 | @@ -1079,8 +1079,8 @@ class TestPersonDeleteSSHKeyFromSSO(TestCaseWithFactory): |
3201 | layer = DatabaseFunctionalLayer |
3202 | |
3203 | def setUp(self): |
3204 | - super(TestPersonDeleteSSHKeyFromSSO, self).setUp() |
3205 | - self.sso = getUtility(IPersonSet).getByName(u'ubuntu-sso') |
3206 | + super().setUp() |
3207 | + self.sso = getUtility(IPersonSet).getByName('ubuntu-sso') |
3208 | |
3209 | def test_restricted_to_sso(self): |
3210 | # Only the ubuntu-sso celebrity can invoke this |
3211 | @@ -1089,14 +1089,14 @@ class TestPersonDeleteSSHKeyFromSSO(TestCaseWithFactory): |
3212 | with person_logged_in(target): |
3213 | key = self.factory.makeSSHKey(target) |
3214 | key_text = key.getFullKeyText() |
3215 | - make_openid_identifier(target.account, u'openid') |
3216 | + make_openid_identifier(target.account, 'openid') |
3217 | |
3218 | def do_it(): |
3219 | return getUtility(IPersonSet).deleteSSHKeyFromSSO( |
3220 | - getUtility(ILaunchBag).user, u'openid', key_text, False) |
3221 | + getUtility(ILaunchBag).user, 'openid', key_text, False) |
3222 | random = self.factory.makePerson() |
3223 | admin = self.factory.makePerson( |
3224 | - member_of=[getUtility(IPersonSet).getByName(u'admins')]) |
3225 | + member_of=[getUtility(IPersonSet).getByName('admins')]) |
3226 | |
3227 | # Anonymous, random or admin users can't invoke the method. |
3228 | with anonymous_logged_in(): |
3229 | @@ -1112,11 +1112,11 @@ class TestPersonDeleteSSHKeyFromSSO(TestCaseWithFactory): |
3230 | target = self.factory.makePerson(name='username') |
3231 | with person_logged_in(target): |
3232 | key = self.factory.makeSSHKey(target) |
3233 | - make_openid_identifier(target.account, u'openid') |
3234 | + make_openid_identifier(target.account, 'openid') |
3235 | |
3236 | with person_logged_in(self.sso): |
3237 | getUtility(IPersonSet).deleteSSHKeyFromSSO( |
3238 | - self.sso, u'openid', key.getFullKeyText(), False) |
3239 | + self.sso, 'openid', key.getFullKeyText(), False) |
3240 | |
3241 | with person_logged_in(target): |
3242 | self.assertEqual(0, target.sshkeys.count()) |
3243 | @@ -1125,11 +1125,11 @@ class TestPersonDeleteSSHKeyFromSSO(TestCaseWithFactory): |
3244 | target = self.factory.makePerson(name='username') |
3245 | with person_logged_in(target): |
3246 | key = self.factory.makeSSHKey(target) |
3247 | - make_openid_identifier(target.account, u'openid') |
3248 | + make_openid_identifier(target.account, 'openid') |
3249 | |
3250 | with person_logged_in(self.sso): |
3251 | getUtility(IPersonSet).deleteSSHKeyFromSSO( |
3252 | - self.sso, u'openid', key.getFullKeyText(), True) |
3253 | + self.sso, 'openid', key.getFullKeyText(), True) |
3254 | |
3255 | with person_logged_in(target): |
3256 | self.assertEqual([key], list(target.sshkeys)) |
3257 | @@ -1139,16 +1139,16 @@ class TestPersonDeleteSSHKeyFromSSO(TestCaseWithFactory): |
3258 | self.assertRaises( |
3259 | NoSuchAccount, |
3260 | getUtility(IPersonSet).deleteSSHKeyFromSSO, |
3261 | - self.sso, u'doesnotexist', 'ssh-rsa key comment', False) |
3262 | + self.sso, 'doesnotexist', 'ssh-rsa key comment', False) |
3263 | |
3264 | def test_raises_with_bad_key_type(self): |
3265 | target = self.factory.makePerson(name='username') |
3266 | - make_openid_identifier(target.account, u'openid') |
3267 | + make_openid_identifier(target.account, 'openid') |
3268 | with person_logged_in(self.sso): |
3269 | self.assertRaises( |
3270 | SSHKeyAdditionError, |
3271 | getUtility(IPersonSet).deleteSSHKeyFromSSO, |
3272 | - self.sso, u'openid', 'badtype key comment', False) |
3273 | + self.sso, 'openid', 'badtype key comment', False) |
3274 | |
3275 | |
3276 | class TestGDPRUserRetrieval(TestCaseWithFactory): |
3277 | @@ -1156,7 +1156,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3278 | layer = LaunchpadFunctionalLayer |
3279 | |
3280 | def setUp(self): |
3281 | - super(TestGDPRUserRetrieval, self).setUp() |
3282 | + super().setUp() |
3283 | self.person_set = getUtility(IPersonSet) |
3284 | self.user = self.factory.makePerson() |
3285 | self.factory.makeGPGKey(self.user) |
3286 | @@ -1189,13 +1189,13 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3287 | |
3288 | def test_no_data(self): |
3289 | with admin_logged_in(): |
3290 | - result = self.person_set.getUserData(u"no@example.com") |
3291 | + result = self.person_set.getUserData("no@example.com") |
3292 | self.assertDictEqual({"status": "no data held"}, result) |
3293 | |
3294 | def test_account_data(self): |
3295 | person = self.factory.makePerson(email="test@example.com") |
3296 | with admin_logged_in(): |
3297 | - result = self.person_set.getUserData(u"test@example.com") |
3298 | + result = self.person_set.getUserData("test@example.com") |
3299 | self.assertDictEqual({ |
3300 | "status": "account only; no other data", |
3301 | "person": canonical_url(person)}, |
3302 | @@ -1206,7 +1206,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3303 | with person_logged_in(person): |
3304 | person.hide_email_addresses = True |
3305 | with admin_logged_in(): |
3306 | - result = self.person_set.getUserData(u"test@example.com") |
3307 | + result = self.person_set.getUserData("test@example.com") |
3308 | self.assertDictEqual({ |
3309 | "status": "account only; no other data", |
3310 | "person": canonical_url(person)}, |
3311 | @@ -1219,7 +1219,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3312 | person, |
3313 | email_status=EmailAddressStatus.NEW) |
3314 | with admin_logged_in(): |
3315 | - result = self.person_set.getUserData(u"new@example.com") |
3316 | + result = self.person_set.getUserData("new@example.com") |
3317 | self.assertDictEqual({ |
3318 | "status": "account only; no other data", |
3319 | "person": canonical_url(person)}, |
3320 | @@ -1229,7 +1229,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3321 | person = self.factory.makePerson(email="test@example.com") |
3322 | self.factory.makeBranch(owner=person) |
3323 | with admin_logged_in(): |
3324 | - result = self.person_set.getUserData(u"test@example.com") |
3325 | + result = self.person_set.getUserData("test@example.com") |
3326 | self.assertThat(result, ContainsDict({ |
3327 | "status": Equals("account with data"), |
3328 | "person": Equals(canonical_url(person)), |
3329 | @@ -1241,7 +1241,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3330 | person = self.factory.makePerson(email="test@example.com") |
3331 | self.factory.makeGitRepository(owner=person) |
3332 | with admin_logged_in(): |
3333 | - result = self.person_set.getUserData(u"test@example.com") |
3334 | + result = self.person_set.getUserData("test@example.com") |
3335 | self.assertDictEqual({ |
3336 | "status": "account with data", |
3337 | "person": canonical_url(person), |
3338 | @@ -1256,7 +1256,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3339 | other_person = self.factory.makePerson(email="other@example.com") |
3340 | self.factory.makeGitRepository(owner=other_person) |
3341 | with admin_logged_in(): |
3342 | - result = self.person_set.getUserData(u"test@example.com") |
3343 | + result = self.person_set.getUserData("test@example.com") |
3344 | self.assertDictEqual({ |
3345 | "status": "account only; no other data", |
3346 | "person": canonical_url(person)}, |
3347 | @@ -1266,7 +1266,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3348 | person = self.factory.makePerson(email="test@example.com") |
3349 | self.factory.makeBug(owner=person) |
3350 | with admin_logged_in(): |
3351 | - result = self.person_set.getUserData(u"test@example.com") |
3352 | + result = self.person_set.getUserData("test@example.com") |
3353 | self.assertThat(result, ContainsDict({ |
3354 | "status": Equals("account with data"), |
3355 | "person": Equals(canonical_url(person)), |
3356 | @@ -1281,7 +1281,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3357 | person = self.factory.makePerson(email="test@example.com") |
3358 | self.factory.makeBug(owner=person, status=BugTaskStatus.FIXRELEASED) |
3359 | with admin_logged_in(): |
3360 | - result = self.person_set.getUserData(u"test@example.com") |
3361 | + result = self.person_set.getUserData("test@example.com") |
3362 | self.assertThat(result, ContainsDict({ |
3363 | "status": Equals("account with data"), |
3364 | "person": Equals(canonical_url(person)), |
3365 | @@ -1294,7 +1294,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3366 | person = self.factory.makePerson(email="test@example.com") |
3367 | self.factory.makeSpecification(owner=person) |
3368 | with admin_logged_in(): |
3369 | - result = self.person_set.getUserData(u"test@example.com") |
3370 | + result = self.person_set.getUserData("test@example.com") |
3371 | self.assertDictEqual({ |
3372 | "status": "account with data", |
3373 | "person": canonical_url(person), |
3374 | @@ -1306,7 +1306,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3375 | self.factory.makeSuggestion(translator=person) |
3376 | self.factory.makeTranslator(person=person) |
3377 | with admin_logged_in(): |
3378 | - result = self.person_set.getUserData(u"test@example.com") |
3379 | + result = self.person_set.getUserData("test@example.com") |
3380 | self.assertThat(result, MatchesDict({ |
3381 | "status": Equals("account with data"), |
3382 | "person": Equals(canonical_url(person)), |
3383 | @@ -1320,7 +1320,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3384 | person = self.factory.makePerson(email="test@example.com") |
3385 | self.factory.makeQuestion(owner=person) |
3386 | with admin_logged_in(): |
3387 | - result = self.person_set.getUserData(u"test@example.com") |
3388 | + result = self.person_set.getUserData("test@example.com") |
3389 | self.assertThat(result, ContainsDict({ |
3390 | "status": Equals("account with data"), |
3391 | "person": Equals(canonical_url(person)), |
3392 | @@ -1333,7 +1333,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3393 | question = self.factory.makeQuestion(owner=self.factory.makePerson()) |
3394 | with admin_logged_in(): |
3395 | question.addComment(person, "A comment") |
3396 | - result = self.person_set.getUserData(u"test@example.com") |
3397 | + result = self.person_set.getUserData("test@example.com") |
3398 | self.assertThat(result, ContainsDict({ |
3399 | "status": Equals("account with data"), |
3400 | "person": Equals(canonical_url(person)), |
3401 | @@ -1346,7 +1346,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3402 | question = self.factory.makeQuestion(owner=person) |
3403 | with admin_logged_in(): |
3404 | question.setStatus(person, QuestionStatus.SOLVED, "solved!") |
3405 | - result = self.person_set.getUserData(u"test@example.com") |
3406 | + result = self.person_set.getUserData("test@example.com") |
3407 | self.assertThat(result, ContainsDict({ |
3408 | "status": Equals("account with data"), |
3409 | "person": Equals(canonical_url(person)), |
3410 | @@ -1358,7 +1358,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3411 | person = self.factory.makePerson(email="test@example.com") |
3412 | with admin_logged_in(): |
3413 | self.factory.makeSSHKey(person) |
3414 | - result = self.person_set.getUserData(u"test@example.com") |
3415 | + result = self.person_set.getUserData("test@example.com") |
3416 | self.assertDictEqual({ |
3417 | "status": "account with data", |
3418 | "person": canonical_url(person), |
3419 | @@ -1369,7 +1369,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3420 | person = self.factory.makePerson(email="test@example.com") |
3421 | with admin_logged_in(): |
3422 | self.factory.makeGPGKey(person) |
3423 | - result = self.person_set.getUserData(u"test@example.com") |
3424 | + result = self.person_set.getUserData("test@example.com") |
3425 | self.assertThat(result, ContainsDict({ |
3426 | "status": Equals("account with data"), |
3427 | "person": Equals(canonical_url(person)), |
3428 | @@ -1381,7 +1381,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory): |
3429 | with admin_logged_in(): |
3430 | key = self.factory.makeGPGKey(person) |
3431 | key.active = False |
3432 | - result = self.person_set.getUserData(u"test@example.com") |
3433 | + result = self.person_set.getUserData("test@example.com") |
3434 | self.assertThat(result, ContainsDict({ |
3435 | "status": Equals("account with data"), |
3436 | "person": Equals(canonical_url(person)), |
3437 | diff --git a/lib/lp/registry/tests/test_persontransferjob.py b/lib/lp/registry/tests/test_persontransferjob.py |
3438 | index bc78115..70fab28 100644 |
3439 | --- a/lib/lp/registry/tests/test_persontransferjob.py |
3440 | +++ b/lib/lp/registry/tests/test_persontransferjob.py |
3441 | @@ -40,7 +40,7 @@ class PersonTransferJobTestCase(TestCaseWithFactory): |
3442 | # gets unserialized from JSON, so the representation returned by |
3443 | # person_transfer_job.metadata will be different from what we |
3444 | # originally passed in. |
3445 | - metadata_expected = [u'some', u'arbitrary', u'metadata'] |
3446 | + metadata_expected = ['some', 'arbitrary', 'metadata'] |
3447 | self.assertEqual(metadata_expected, person_transfer_job.metadata) |
3448 | |
3449 | |
3450 | diff --git a/lib/lp/registry/tests/test_pillar.py b/lib/lp/registry/tests/test_pillar.py |
3451 | index 0ff1db2..e4efd3c 100644 |
3452 | --- a/lib/lp/registry/tests/test_pillar.py |
3453 | +++ b/lib/lp/registry/tests/test_pillar.py |
3454 | @@ -40,7 +40,7 @@ class TestPillarNameSet(TestCaseWithFactory): |
3455 | pillar.name for pillar in |
3456 | pillar_set.search( |
3457 | getUtility(IPersonSet).getByName('mark'), 'lz', limit=5)] |
3458 | - self.assertEqual(result_names, [u'launchzap', u'lz-bar', u'lz-foo']) |
3459 | + self.assertEqual(result_names, ['launchzap', 'lz-bar', 'lz-foo']) |
3460 | |
3461 | def test_search_percent(self): |
3462 | """Searches involving '%' characters work correctly.""" |
3463 | @@ -52,7 +52,7 @@ class TestPillarNameSet(TestCaseWithFactory): |
3464 | result_names = [ |
3465 | pillar.name |
3466 | for pillar in pillar_set.search(mark, '% character', limit=5)] |
3467 | - self.assertEqual([u'percent'], result_names) |
3468 | + self.assertEqual(['percent'], result_names) |
3469 | |
3470 | |
3471 | class TestPillarPerson(TestCaseWithFactory): |
3472 | diff --git a/lib/lp/registry/tests/test_pillar_vocabularies.py b/lib/lp/registry/tests/test_pillar_vocabularies.py |
3473 | index 08ada9d..d2288eb 100644 |
3474 | --- a/lib/lp/registry/tests/test_pillar_vocabularies.py |
3475 | +++ b/lib/lp/registry/tests/test_pillar_vocabularies.py |
3476 | @@ -23,7 +23,7 @@ class TestPillarVocabularyBase(TestCaseWithFactory): |
3477 | layer = DatabaseFunctionalLayer |
3478 | |
3479 | def setUp(self): |
3480 | - super(TestPillarVocabularyBase, self).setUp() |
3481 | + super().setUp() |
3482 | self.vocabulary = PillarVocabularyBase() |
3483 | self.product = self.factory.makeProduct(name='orchid-snark') |
3484 | self.distribution = self.factory.makeDistribution(name='zebra-snark') |
3485 | @@ -98,7 +98,7 @@ class TestDistributionOrProductVocabulary(TestCaseWithFactory, |
3486 | layer = DatabaseFunctionalLayer |
3487 | |
3488 | def setUp(self): |
3489 | - super(TestDistributionOrProductVocabulary, self).setUp() |
3490 | + super().setUp() |
3491 | self.vocabulary = DistributionOrProductVocabulary() |
3492 | self.product = self.factory.makeProduct(name='orchid-snark') |
3493 | self.distribution = self.factory.makeDistribution(name='zebra-snark') |
3494 | @@ -143,7 +143,7 @@ class TestDistributionOrProductOrProjectGroupVocabulary(TestCaseWithFactory, |
3495 | layer = DatabaseFunctionalLayer |
3496 | |
3497 | def setUp(self): |
3498 | - super(TestDistributionOrProductOrProjectGroupVocabulary, self).setUp() |
3499 | + super().setUp() |
3500 | self.vocabulary = DistributionOrProductOrProjectGroupVocabulary() |
3501 | self.product = self.factory.makeProduct(name='orchid-snark') |
3502 | self.distribution = self.factory.makeDistribution(name='zebra-snark') |
3503 | diff --git a/lib/lp/registry/tests/test_poll.py b/lib/lp/registry/tests/test_poll.py |
3504 | index ebd2dde..6d940a4 100644 |
3505 | --- a/lib/lp/registry/tests/test_poll.py |
3506 | +++ b/lib/lp/registry/tests/test_poll.py |
3507 | @@ -54,7 +54,7 @@ class TestPoll(TestCaseWithFactory): |
3508 | class MatchesPollAPI(ContainsDict): |
3509 | |
3510 | def __init__(self, webservice, poll): |
3511 | - super(MatchesPollAPI, self).__init__({ |
3512 | + super().__init__({ |
3513 | "team_link": Equals(webservice.getAbsoluteUrl(api_url(poll.team))), |
3514 | "name": Equals(poll.name), |
3515 | "title": Equals(poll.title), |
3516 | @@ -71,7 +71,7 @@ class TestPollWebservice(TestCaseWithFactory): |
3517 | layer = LaunchpadFunctionalLayer |
3518 | |
3519 | def setUp(self): |
3520 | - super(TestPollWebservice, self).setUp() |
3521 | + super().setUp() |
3522 | self.person = self.factory.makePerson() |
3523 | self.pushConfig("launchpad", default_batch_size=50) |
3524 | |
3525 | diff --git a/lib/lp/registry/tests/test_prf_finder.py b/lib/lp/registry/tests/test_prf_finder.py |
3526 | index 7b4c024..983f16e 100644 |
3527 | --- a/lib/lp/registry/tests/test_prf_finder.py |
3528 | +++ b/lib/lp/registry/tests/test_prf_finder.py |
3529 | @@ -151,7 +151,7 @@ class GetFiltersTestCase(TestCaseWithFactory): |
3530 | class HandleProductTestCase(TestCase): |
3531 | |
3532 | def setUp(self): |
3533 | - super(HandleProductTestCase, self).setUp() |
3534 | + super().setUp() |
3535 | # path for release tree |
3536 | self.release_root = tempfile.mkdtemp() |
3537 | self.addCleanup(shutil.rmtree, self.release_root, ignore_errors=True) |
3538 | @@ -235,7 +235,7 @@ class HandleReleaseTestCase(TestCase): |
3539 | return url |
3540 | |
3541 | def setUp(self): |
3542 | - super(HandleReleaseTestCase, self).setUp() |
3543 | + super().setUp() |
3544 | switch_dbuser(config.productreleasefinder.dbuser) |
3545 | self.release_root = tempfile.mkdtemp() |
3546 | self.addCleanup(shutil.rmtree, self.release_root, ignore_errors=True) |
3547 | diff --git a/lib/lp/registry/tests/test_prf_walker.py b/lib/lp/registry/tests/test_prf_walker.py |
3548 | index 04012e1..c0c88d9 100644 |
3549 | --- a/lib/lp/registry/tests/test_prf_walker.py |
3550 | +++ b/lib/lp/registry/tests/test_prf_walker.py |
3551 | @@ -146,7 +146,7 @@ class WalkerBase_walk(TestCase): |
3552 | |
3553 | def tearDown(self): |
3554 | reset_logging() |
3555 | - super(WalkerBase_walk, self).tearDown() |
3556 | + super().tearDown() |
3557 | |
3558 | def test_walk_UnicodeEncodeError(self): |
3559 | """Verify that a UnicodeEncodeError is logged.""" |
3560 | @@ -156,7 +156,7 @@ class WalkerBase_walk(TestCase): |
3561 | def list(self, sub_dir): |
3562 | # Force the walker to handle an exception. |
3563 | raise UnicodeEncodeError( |
3564 | - 'utf-8', u'source text', 0, 1, 'reason') |
3565 | + 'utf-8', 'source text', 0, 1, 'reason') |
3566 | |
3567 | def open(self): |
3568 | pass |
3569 | @@ -184,7 +184,7 @@ class WalkerBase_walk(TestCase): |
3570 | pass |
3571 | |
3572 | def open(self): |
3573 | - raise IOError("Test failure.") |
3574 | + raise OSError("Test failure.") |
3575 | |
3576 | def close(self): |
3577 | pass |
3578 | @@ -254,7 +254,7 @@ class HTTPWalker_Base(TestCase): |
3579 | class HTTPWalker_ListDir(TestCase): |
3580 | |
3581 | def setUp(self): |
3582 | - super(HTTPWalker_ListDir, self).setUp() |
3583 | + super().setUp() |
3584 | self.addCleanup(reset_logging) |
3585 | original_timeout_function = get_default_timeout_function() |
3586 | set_default_timeout_function(lambda: 60.0) |
3587 | @@ -443,7 +443,7 @@ class HTTPWalker_IsDirectory(TestCase): |
3588 | |
3589 | def tearDown(self): |
3590 | reset_logging() |
3591 | - super(HTTPWalker_IsDirectory, self).tearDown() |
3592 | + super().tearDown() |
3593 | |
3594 | def testFtpIsDirectory(self): |
3595 | # Test that no requests are made by isDirectory() when walking |
3596 | diff --git a/lib/lp/registry/tests/test_private_team_visibility.py b/lib/lp/registry/tests/test_private_team_visibility.py |
3597 | index 524963f..6f935a6 100644 |
3598 | --- a/lib/lp/registry/tests/test_private_team_visibility.py |
3599 | +++ b/lib/lp/registry/tests/test_private_team_visibility.py |
3600 | @@ -50,7 +50,7 @@ class TestPrivateTeamVisibility(TestCaseWithFactory): |
3601 | layer = DatabaseFunctionalLayer |
3602 | |
3603 | def setUp(self): |
3604 | - super(TestPrivateTeamVisibility, self).setUp() |
3605 | + super().setUp() |
3606 | self.priv_owner = self.factory.makePerson(name="priv-owner") |
3607 | self.priv_member = self.factory.makePerson(name="priv-member") |
3608 | self.priv_team = self.factory.makeTeam( |
3609 | diff --git a/lib/lp/registry/tests/test_product.py b/lib/lp/registry/tests/test_product.py |
3610 | index 656f7ec..d0eb5a6 100644 |
3611 | --- a/lib/lp/registry/tests/test_product.py |
3612 | +++ b/lib/lp/registry/tests/test_product.py |
3613 | @@ -272,7 +272,7 @@ class TestProduct(TestCaseWithFactory): |
3614 | for name in ('1', '2', '3', '3a', '3b', 'alpha', 'beta'): |
3615 | self.factory.makeProductSeries(product=product, name=name) |
3616 | self.assertEqual( |
3617 | - [u'trunk', u'3b', u'3a', u'3', u'2', u'1', u'beta', u'alpha'], |
3618 | + ['trunk', '3b', '3a', '3', '2', '1', 'beta', 'alpha'], |
3619 | [series.name for series in product.getVersionSortedSeries()]) |
3620 | |
3621 | def test_getVersionSortedSeries_with_specific_statuses(self): |
3622 | @@ -289,7 +289,7 @@ class TestProduct(TestCaseWithFactory): |
3623 | active_series = product.getVersionSortedSeries( |
3624 | statuses=[SeriesStatus.OBSOLETE]) |
3625 | self.assertEqual( |
3626 | - [u'trunk', u'obsolete-series'], |
3627 | + ['trunk', 'obsolete-series'], |
3628 | [series.name for series in active_series]) |
3629 | |
3630 | def test_getVersionSortedSeries_without_specific_statuses(self): |
3631 | @@ -306,7 +306,7 @@ class TestProduct(TestCaseWithFactory): |
3632 | active_series = product.getVersionSortedSeries( |
3633 | filter_statuses=[SeriesStatus.OBSOLETE]) |
3634 | self.assertEqual( |
3635 | - [u'trunk', u'active-series'], |
3636 | + ['trunk', 'active-series'], |
3637 | [series.name for series in active_series]) |
3638 | |
3639 | def test_inferred_vcs(self): |
3640 | @@ -1417,7 +1417,7 @@ class TestProductFiles(TestCase): |
3641 | def test_adddownloadfile_nonascii_filename(self): |
3642 | """Test uploading a file with a non-ascii char in the filename.""" |
3643 | firefox_owner = setupBrowser(auth='Basic mark@example.com:test') |
3644 | - filename = u'foo\xa5.txt' |
3645 | + filename = 'foo\xa5.txt' |
3646 | firefox_owner.open( |
3647 | 'http://launchpad.test/firefox/1.0/1.0.0/+adddownloadfile') |
3648 | foo_file = BytesIO(b'Foo installer package...') |
3649 | @@ -1432,7 +1432,7 @@ class TestProductFiles(TestCase): |
3650 | firefox_owner.getControl("Upload").click() |
3651 | self.assertEqual( |
3652 | get_feedback_messages(firefox_owner.contents), |
3653 | - [u"Your file 'foo\xa5.txt' has been uploaded."]) |
3654 | + ["Your file 'foo\xa5.txt' has been uploaded."]) |
3655 | firefox_owner.open('http://launchpad.test/firefox/+download') |
3656 | content = find_main_content(firefox_owner.contents) |
3657 | rows = content.find_all('tr') |
3658 | @@ -1443,21 +1443,21 @@ class TestProductFiles(TestCase): |
3659 | self.assertEqual( |
3660 | a_element['href'], |
3661 | 'http://launchpad.test/firefox/1.0/1.0.0/+download/foo%C2%A5.txt') |
3662 | - self.assertEqual(a_element.contents[0].strip(), u'foo\xa5.txt') |
3663 | + self.assertEqual(a_element.contents[0].strip(), 'foo\xa5.txt') |
3664 | # 2nd row |
3665 | a_element = a_list[1] |
3666 | self.assertEqual( |
3667 | a_element['href'], |
3668 | 'http://launchpad.test/firefox/1.0/1.0.0/+download/' |
3669 | 'foo%C2%A5.txt/+md5') |
3670 | - self.assertEqual(a_element.contents[0].strip(), u'md5') |
3671 | + self.assertEqual(a_element.contents[0].strip(), 'md5') |
3672 | # 3rd row |
3673 | a_element = a_list[2] |
3674 | self.assertEqual( |
3675 | a_element['href'], |
3676 | 'http://launchpad.test/firefox/1.0/1.0.0/+download/' |
3677 | 'foo%C2%A5.txt.asc') |
3678 | - self.assertEqual(a_element.contents[0].strip(), u'sig') |
3679 | + self.assertEqual(a_element.contents[0].strip(), 'sig') |
3680 | |
3681 | |
3682 | class ProductAttributeCacheTestCase(TestCaseWithFactory): |
3683 | @@ -1466,7 +1466,7 @@ class ProductAttributeCacheTestCase(TestCaseWithFactory): |
3684 | layer = DatabaseFunctionalLayer |
3685 | |
3686 | def setUp(self): |
3687 | - super(ProductAttributeCacheTestCase, self).setUp() |
3688 | + super().setUp() |
3689 | self.product = Product.selectOneBy(name='tomcat') |
3690 | |
3691 | def testLicensesCache(self): |
3692 | @@ -1580,7 +1580,7 @@ class ProductLicensingTestCase(TestCaseWithFactory): |
3693 | product = self.factory.makeProduct() |
3694 | self.factory.makeCommercialSubscription(product) |
3695 | with celebrity_logged_in('admin'): |
3696 | - product.commercial_subscription.sales_system_id = u'testing' |
3697 | + product.commercial_subscription.sales_system_id = 'testing' |
3698 | date_expires = product.commercial_subscription.date_expires |
3699 | with person_logged_in(product.owner): |
3700 | product.licenses = [License.OTHER_PROPRIETARY] |
3701 | @@ -1647,7 +1647,7 @@ class BaseSharingPolicyTests: |
3702 | raise NotImplementedError |
3703 | |
3704 | def setUp(self): |
3705 | - super(BaseSharingPolicyTests, self).setUp() |
3706 | + super().setUp() |
3707 | self.product = self.factory.makeProduct() |
3708 | self.commercial_admin = self.factory.makeCommercialAdmin() |
3709 | |
3710 | @@ -1880,7 +1880,7 @@ class ProductSnapshotTestCase(TestCaseWithFactory): |
3711 | layer = ZopelessDatabaseLayer |
3712 | |
3713 | def setUp(self): |
3714 | - super(ProductSnapshotTestCase, self).setUp() |
3715 | + super().setUp() |
3716 | self.product = self.factory.makeProduct(name="shamwow") |
3717 | |
3718 | def test_excluded_from_snapshot(self): |
3719 | @@ -1925,7 +1925,7 @@ class TestSpecifications(TestCaseWithFactory): |
3720 | layer = DatabaseFunctionalLayer |
3721 | |
3722 | def setUp(self): |
3723 | - super(TestSpecifications, self).setUp() |
3724 | + super().setUp() |
3725 | self.date_created = datetime.now(pytz.utc) |
3726 | |
3727 | def makeSpec(self, product=None, date_created=0, title=None, |
3728 | @@ -2074,9 +2074,9 @@ class TestSpecifications(TestCaseWithFactory): |
3729 | blueprint1 = self.makeSpec(title='abc') |
3730 | product = blueprint1.product |
3731 | blueprint2 = self.makeSpec(product, title='def') |
3732 | - result = list_result(product, [u'abc']) |
3733 | + result = list_result(product, ['abc']) |
3734 | self.assertEqual([blueprint1], result) |
3735 | - result = list_result(product, [u'def']) |
3736 | + result = list_result(product, ['def']) |
3737 | self.assertEqual([blueprint2], result) |
3738 | |
3739 | def test_proprietary_not_listed(self): |
3740 | @@ -2143,7 +2143,7 @@ class TestWebService(WebServiceTestCase): |
3741 | # The product layer provides the context restriction, so we need to |
3742 | # check we can access context filtered references - e.g. on question. |
3743 | oopsid = "OOPS-abcdef1234" |
3744 | - question = self.factory.makeQuestion(title=u"Crash with %s" % oopsid) |
3745 | + question = self.factory.makeQuestion(title="Crash with %s" % oopsid) |
3746 | product = question.product |
3747 | transaction.commit() |
3748 | ws_product = self.wsObject(product, product.owner) |
3749 | @@ -2161,7 +2161,7 @@ class TestWebService(WebServiceTestCase): |
3750 | # The product layer provides the context restriction, so we need to |
3751 | # check the filter is tight enough - other contexts should not work. |
3752 | oopsid = "OOPS-abcdef1234" |
3753 | - self.factory.makeQuestion(title=u"Crash with %s" % oopsid) |
3754 | + self.factory.makeQuestion(title="Crash with %s" % oopsid) |
3755 | product = self.factory.makeProduct() |
3756 | transaction.commit() |
3757 | ws_product = self.wsObject(product, product.owner) |
3758 | diff --git a/lib/lp/registry/tests/test_product_vocabularies.py b/lib/lp/registry/tests/test_product_vocabularies.py |
3759 | index 83a3e9c..0261b64 100644 |
3760 | --- a/lib/lp/registry/tests/test_product_vocabularies.py |
3761 | +++ b/lib/lp/registry/tests/test_product_vocabularies.py |
3762 | @@ -23,7 +23,7 @@ class TestProductVocabulary(TestCaseWithFactory): |
3763 | layer = DatabaseFunctionalLayer |
3764 | |
3765 | def setUp(self): |
3766 | - super(TestProductVocabulary, self).setUp() |
3767 | + super().setUp() |
3768 | self.vocabulary = ProductVocabulary() |
3769 | self.product = self.factory.makeProduct( |
3770 | name='bedbugs', displayname='BedBugs') |
3771 | diff --git a/lib/lp/registry/tests/test_productrelease.py b/lib/lp/registry/tests/test_productrelease.py |
3772 | index 8a837da..39c8222 100644 |
3773 | --- a/lib/lp/registry/tests/test_productrelease.py |
3774 | +++ b/lib/lp/registry/tests/test_productrelease.py |
3775 | @@ -30,7 +30,7 @@ class ProductReleaseSetTestcase(TestCaseWithFactory): |
3776 | layer = DatabaseFunctionalLayer |
3777 | |
3778 | def setUp(self): |
3779 | - super(ProductReleaseSetTestcase, self).setUp() |
3780 | + super().setUp() |
3781 | self.product_release_set = getUtility(IProductReleaseSet) |
3782 | |
3783 | def test_getBySeriesAndVersion_match(self): |
3784 | diff --git a/lib/lp/registry/tests/test_productseries.py b/lib/lp/registry/tests/test_productseries.py |
3785 | index 52fdbcc..da6f828 100644 |
3786 | --- a/lib/lp/registry/tests/test_productseries.py |
3787 | +++ b/lib/lp/registry/tests/test_productseries.py |
3788 | @@ -445,7 +445,7 @@ class TestProductSeriesSet(TestCaseWithFactory): |
3789 | layer = ZopelessDatabaseLayer |
3790 | |
3791 | def setUp(self): |
3792 | - super(TestProductSeriesSet, self).setUp() |
3793 | + super().setUp() |
3794 | self.ps_set = getUtility(IProductSeriesSet) |
3795 | |
3796 | def _makeSeriesAndBranch(self, import_mode, branch=None, link_branch=True): |
3797 | @@ -532,7 +532,7 @@ class TestProductSeriesReleases(TestCaseWithFactory): |
3798 | layer = DatabaseFunctionalLayer |
3799 | |
3800 | def setUp(self): |
3801 | - super(TestProductSeriesReleases, self).setUp() |
3802 | + super().setUp() |
3803 | self.product = self.factory.makeProduct() |
3804 | self.productseries = self.factory.makeProductSeries( |
3805 | product=self.product) |
3806 | @@ -585,7 +585,7 @@ class ProductSeriesSecurityAdaperTestCase(TestCaseWithFactory): |
3807 | layer = DatabaseFunctionalLayer |
3808 | |
3809 | def setUp(self): |
3810 | - super(ProductSeriesSecurityAdaperTestCase, self).setUp() |
3811 | + super().setUp() |
3812 | self.public_product = self.factory.makeProduct() |
3813 | self.public_series = self.factory.makeProductSeries( |
3814 | product=self.public_product) |
3815 | diff --git a/lib/lp/registry/tests/test_productseries_vocabularies.py b/lib/lp/registry/tests/test_productseries_vocabularies.py |
3816 | index 88121d8..4010dc5 100644 |
3817 | --- a/lib/lp/registry/tests/test_productseries_vocabularies.py |
3818 | +++ b/lib/lp/registry/tests/test_productseries_vocabularies.py |
3819 | @@ -19,7 +19,7 @@ class TestProductSeriesVocabulary(TestCaseWithFactory): |
3820 | layer = DatabaseFunctionalLayer |
3821 | |
3822 | def setUp(self): |
3823 | - super(TestProductSeriesVocabulary, self).setUp() |
3824 | + super().setUp() |
3825 | self.vocabulary = ProductSeriesVocabulary() |
3826 | self.product_prefix = 'asdf987-' |
3827 | self.series1_prefix = 'qwerty-' |
3828 | diff --git a/lib/lp/registry/tests/test_project_milestone.py b/lib/lp/registry/tests/test_project_milestone.py |
3829 | index 5caa8f7..9b4f767 100644 |
3830 | --- a/lib/lp/registry/tests/test_project_milestone.py |
3831 | +++ b/lib/lp/registry/tests/test_project_milestone.py |
3832 | @@ -103,18 +103,18 @@ class ProjectMilestoneTest(unittest.TestCase): |
3833 | # milestone of the same name. |
3834 | gnome_milestone_names = [ |
3835 | milestone.name for milestone in gnome.all_milestones] |
3836 | - self.assertEqual(gnome_milestone_names, [u'2.1.6', u'1.0']) |
3837 | + self.assertEqual(gnome_milestone_names, ['2.1.6', '1.0']) |
3838 | self.createProductMilestone('1.1', 'evolution', None) |
3839 | gnome_milestone_names = [ |
3840 | milestone.name for milestone in gnome.all_milestones] |
3841 | - self.assertEqual(gnome_milestone_names, [u'2.1.6', u'1.1', u'1.0']) |
3842 | + self.assertEqual(gnome_milestone_names, ['2.1.6', '1.1', '1.0']) |
3843 | |
3844 | # There is only one project milestone named '1.1', regardless of the |
3845 | # number of product milestones with this name. |
3846 | self.createProductMilestone('1.1', 'gnomebaker', None) |
3847 | gnome_milestone_names = [ |
3848 | milestone.name for milestone in gnome.all_milestones] |
3849 | - self.assertEqual(gnome_milestone_names, [u'2.1.6', u'1.1', u'1.0']) |
3850 | + self.assertEqual(gnome_milestone_names, ['2.1.6', '1.1', '1.0']) |
3851 | |
3852 | def test_milestone_date_expected(self): |
3853 | """The dateexpected attribute. |
3854 | @@ -170,7 +170,7 @@ class ProjectMilestoneTest(unittest.TestCase): |
3855 | # ... while project.all_milestones lists inactive milestones too. |
3856 | self.assertEqual( |
3857 | [milestone.name for milestone in gnome.all_milestones], |
3858 | - [u'2.1.6', u'1.1', u'1.0']) |
3859 | + ['2.1.6', '1.1', '1.0']) |
3860 | |
3861 | def test_no_foreign_milestones(self): |
3862 | """Milestones in "foreign" products. |
3863 | @@ -186,7 +186,7 @@ class ProjectMilestoneTest(unittest.TestCase): |
3864 | gnome = getUtility(IProjectGroupSet)['gnome'] |
3865 | self.assertEqual( |
3866 | [milestone.name for milestone in gnome.all_milestones], |
3867 | - [u'2.1.6', u'1.0']) |
3868 | + ['2.1.6', '1.0']) |
3869 | |
3870 | def createSpecification(self, milestone_name, product_name): |
3871 | """Create a specification, assigned to a milestone, for a product.""" |
3872 | diff --git a/lib/lp/registry/tests/test_projectgroup.py b/lib/lp/registry/tests/test_projectgroup.py |
3873 | index abf6460..2f32fba 100644 |
3874 | --- a/lib/lp/registry/tests/test_projectgroup.py |
3875 | +++ b/lib/lp/registry/tests/test_projectgroup.py |
3876 | @@ -69,7 +69,7 @@ class ProjectGroupSearchTestCase(TestCaseWithFactory): |
3877 | layer = LaunchpadFunctionalLayer |
3878 | |
3879 | def setUp(self): |
3880 | - super(ProjectGroupSearchTestCase, self).setUp() |
3881 | + super().setUp() |
3882 | self.person = self.factory.makePerson() |
3883 | self.projectgroup1 = self.factory.makeProject( |
3884 | name="zazzle", owner=self.person) |
3885 | @@ -155,7 +155,7 @@ class TestProjectGroupPermissions(TestCaseWithFactory): |
3886 | layer = DatabaseFunctionalLayer |
3887 | |
3888 | def setUp(self): |
3889 | - super(TestProjectGroupPermissions, self).setUp() |
3890 | + super().setUp() |
3891 | self.pg = self.factory.makeProject(name='my-project-group') |
3892 | |
3893 | def test_attribute_changes_by_admin(self): |
3894 | diff --git a/lib/lp/registry/tests/test_service_usage.py b/lib/lp/registry/tests/test_service_usage.py |
3895 | index 413eb37..9a4bb2b 100644 |
3896 | --- a/lib/lp/registry/tests/test_service_usage.py |
3897 | +++ b/lib/lp/registry/tests/test_service_usage.py |
3898 | @@ -13,7 +13,7 @@ from lp.testing import ( |
3899 | from lp.testing.layers import DatabaseFunctionalLayer |
3900 | |
3901 | |
3902 | -class UsageEnumsMixin(object): |
3903 | +class UsageEnumsMixin: |
3904 | """Base class for testing the UsageEnums on their pillars.""" |
3905 | |
3906 | def setUp(self): |
3907 | @@ -114,7 +114,7 @@ class UsageEnumsMixin(object): |
3908 | self.target.official_blueprints) |
3909 | |
3910 | |
3911 | -class SeriesUsageEnumsMixin(object): |
3912 | +class SeriesUsageEnumsMixin: |
3913 | """Mixin to test the usage attributes on product and distro series.""" |
3914 | |
3915 | def setUp(self): |
3916 | @@ -146,7 +146,7 @@ class TestDistributionUsageEnums(TestCaseWithFactory, UsageEnumsMixin): |
3917 | layer = DatabaseFunctionalLayer |
3918 | |
3919 | def setUp(self): |
3920 | - super(TestDistributionUsageEnums, self).setUp() |
3921 | + super().setUp() |
3922 | self.target = self.factory.makeDistribution() |
3923 | |
3924 | def test_codehosting_usage(self): |
3925 | @@ -163,7 +163,7 @@ class TestProductUsageEnums(TestCaseWithFactory, UsageEnumsMixin): |
3926 | layer = DatabaseFunctionalLayer |
3927 | |
3928 | def setUp(self): |
3929 | - super(TestProductUsageEnums, self).setUp() |
3930 | + super().setUp() |
3931 | self.target = self.factory.makeProduct() |
3932 | |
3933 | def test_codehosting_unknown(self): |
3934 | @@ -220,7 +220,7 @@ class TestProductSeriesUsageEnums( |
3935 | layer = DatabaseFunctionalLayer |
3936 | |
3937 | def setUp(self): |
3938 | - super(TestProductSeriesUsageEnums, self).setUp() |
3939 | + super().setUp() |
3940 | self.series_pillar = self.factory.makeProduct() |
3941 | self.series = self.factory.makeProductSeries( |
3942 | product=self.series_pillar) |
3943 | @@ -241,7 +241,7 @@ class TestDistroSeriesUsageEnums( |
3944 | layer = DatabaseFunctionalLayer |
3945 | |
3946 | def setUp(self): |
3947 | - super(TestDistroSeriesUsageEnums, self).setUp() |
3948 | + super().setUp() |
3949 | self.series_pillar = self.factory.makeDistribution() |
3950 | self.series = self.factory.makeDistroSeries( |
3951 | distribution=self.series_pillar) |
3952 | diff --git a/lib/lp/registry/tests/test_sharingjob.py b/lib/lp/registry/tests/test_sharingjob.py |
3953 | index 1a96940..d3f0bbb 100644 |
3954 | --- a/lib/lp/registry/tests/test_sharingjob.py |
3955 | +++ b/lib/lp/registry/tests/test_sharingjob.py |
3956 | @@ -276,7 +276,7 @@ class RemoveArtifactSubscriptionsJobTestCase(TestCaseWithFactory): |
3957 | } |
3958 | features.update(SNAP_TESTING_FLAGS) |
3959 | self.useFixture(FeatureFixture(features)) |
3960 | - super(RemoveArtifactSubscriptionsJobTestCase, self).setUp() |
3961 | + super().setUp() |
3962 | |
3963 | def test_create(self): |
3964 | # Create an instance of RemoveArtifactSubscriptionsJob. |
3965 | diff --git a/lib/lp/registry/tests/test_sourcepackage.py b/lib/lp/registry/tests/test_sourcepackage.py |
3966 | index 1cafc6f..ca32cff 100644 |
3967 | --- a/lib/lp/registry/tests/test_sourcepackage.py |
3968 | +++ b/lib/lp/registry/tests/test_sourcepackage.py |
3969 | @@ -276,9 +276,9 @@ class TestSourcePackage(TestCaseWithFactory): |
3970 | 'mozilla-firefox') |
3971 | |
3972 | expected_summary = ( |
3973 | - u'mozilla-firefox: Mozilla Firefox Web Browser\n' |
3974 | - u'mozilla-firefox-data: No summary available for ' |
3975 | - u'mozilla-firefox-data in ubuntu warty.') |
3976 | + 'mozilla-firefox: Mozilla Firefox Web Browser\n' |
3977 | + 'mozilla-firefox-data: No summary available for ' |
3978 | + 'mozilla-firefox-data in ubuntu warty.') |
3979 | self.assertEqual(''.join(expected_summary), sp.summary) |
3980 | |
3981 | def test_deletePackaging(self): |
3982 | diff --git a/lib/lp/registry/tests/test_sourcepackagename_vocabulary.py b/lib/lp/registry/tests/test_sourcepackagename_vocabulary.py |
3983 | index 044b483..3fa73ef 100644 |
3984 | --- a/lib/lp/registry/tests/test_sourcepackagename_vocabulary.py |
3985 | +++ b/lib/lp/registry/tests/test_sourcepackagename_vocabulary.py |
3986 | @@ -42,7 +42,7 @@ class TestSourcePackageNameVocabulary(TestCaseWithFactory): |
3987 | layer = DatabaseFunctionalLayer |
3988 | |
3989 | def setUp(self): |
3990 | - super(TestSourcePackageNameVocabulary, self).setUp() |
3991 | + super().setUp() |
3992 | self.vocabulary = SourcePackageNameVocabulary() |
3993 | self.spns = [ |
3994 | self.factory.makeSourcePackageName(name=name) |
3995 | diff --git a/lib/lp/registry/tests/test_team.py b/lib/lp/registry/tests/test_team.py |
3996 | index b624147..5ba16a2 100644 |
3997 | --- a/lib/lp/registry/tests/test_team.py |
3998 | +++ b/lib/lp/registry/tests/test_team.py |
3999 | @@ -69,7 +69,7 @@ class TestTeamContactAddress(TestCaseWithFactory): |
4000 | mailing_list.address) |
4001 | |
4002 | def setUp(self): |
4003 | - super(TestTeamContactAddress, self).setUp() |
4004 | + super().setUp() |
4005 | |
4006 | self.team = self.factory.makeTeam(name='alpha') |
4007 | self.address = self.factory.makeEmail('team@noplace.org', self.team) |
4008 | @@ -153,7 +153,7 @@ class TestTeamGetTeamAdminsEmailAddresses(TestCaseWithFactory): |
4009 | layer = DatabaseFunctionalLayer |
4010 | |
4011 | def setUp(self): |
4012 | - super(TestTeamGetTeamAdminsEmailAddresses, self).setUp() |
4013 | + super().setUp() |
4014 | self.team = self.factory.makeTeam(name='finch') |
4015 | login_celebrity('admin') |
4016 | |
4017 | @@ -218,7 +218,7 @@ class TestDefaultRenewalPeriodIsRequiredForSomeTeams(TestCaseWithFactory): |
4018 | layer = DatabaseFunctionalLayer |
4019 | |
4020 | def setUp(self): |
4021 | - super(TestDefaultRenewalPeriodIsRequiredForSomeTeams, self).setUp() |
4022 | + super().setUp() |
4023 | self.team = self.factory.makeTeam() |
4024 | login_person(self.team.teamowner) |
4025 | |
4026 | @@ -268,7 +268,7 @@ class TestDefaultMembershipPeriod(TestCaseWithFactory): |
4027 | layer = DatabaseFunctionalLayer |
4028 | |
4029 | def setUp(self): |
4030 | - super(TestDefaultMembershipPeriod, self).setUp() |
4031 | + super().setUp() |
4032 | self.team = self.factory.makeTeam() |
4033 | login_person(self.team.teamowner) |
4034 | |
4035 | @@ -549,7 +549,7 @@ class TestVisibilityConsistencyWarning(TestCaseWithFactory): |
4036 | layer = DatabaseFunctionalLayer |
4037 | |
4038 | def setUp(self): |
4039 | - super(TestVisibilityConsistencyWarning, self).setUp() |
4040 | + super().setUp() |
4041 | self.team = self.factory.makeTeam() |
4042 | login_celebrity('admin') |
4043 | |
4044 | diff --git a/lib/lp/registry/tests/test_team_webservice.py b/lib/lp/registry/tests/test_team_webservice.py |
4045 | index 024b3a3..2275742 100644 |
4046 | --- a/lib/lp/registry/tests/test_team_webservice.py |
4047 | +++ b/lib/lp/registry/tests/test_team_webservice.py |
4048 | @@ -108,7 +108,7 @@ class TestTeamLimitedViewAccess(TestCaseWithFactory): |
4049 | layer = AppServerLayer |
4050 | |
4051 | def setUp(self): |
4052 | - super(TestTeamLimitedViewAccess, self).setUp() |
4053 | + super().setUp() |
4054 | |
4055 | # Make a private team. |
4056 | team_owner = self.factory.makePerson() |
4057 | diff --git a/lib/lp/registry/tests/test_teammembership.py b/lib/lp/registry/tests/test_teammembership.py |
4058 | index 520751f..3f3b58b 100644 |
4059 | --- a/lib/lp/registry/tests/test_teammembership.py |
4060 | +++ b/lib/lp/registry/tests/test_teammembership.py |
4061 | @@ -131,7 +131,7 @@ class TestTeamMembershipSet(TestCaseWithFactory): |
4062 | layer = DatabaseFunctionalLayer |
4063 | |
4064 | def setUp(self): |
4065 | - super(TestTeamMembershipSet, self).setUp() |
4066 | + super().setUp() |
4067 | login('test@canonical.com') |
4068 | self.membershipset = getUtility(ITeamMembershipSet) |
4069 | self.personset = getUtility(IPersonSet) |
4070 | @@ -266,7 +266,7 @@ class TeamParticipationTestCase(TestCaseWithFactory): |
4071 | layer = DatabaseFunctionalLayer |
4072 | |
4073 | def setUp(self): |
4074 | - super(TeamParticipationTestCase, self).setUp() |
4075 | + super().setUp() |
4076 | login('foo.bar@canonical.com') |
4077 | person_set = getUtility(IPersonSet) |
4078 | self.foo_bar = person_set.getByEmail('foo.bar@canonical.com') |
4079 | @@ -360,7 +360,7 @@ class TestTeamParticipationHierarchy(TeamParticipationTestCase): |
4080 | |
4081 | def setUp(self): |
4082 | """Setup the team hierarchy.""" |
4083 | - super(TestTeamParticipationHierarchy, self).setUp() |
4084 | + super().setUp() |
4085 | self.team5.addMember(self.no_priv, self.foo_bar) |
4086 | self.team1.addMember(self.team2, self.foo_bar, force_team_add=True) |
4087 | self.team2.addMember(self.team3, self.foo_bar, force_team_add=True) |
4088 | @@ -436,7 +436,7 @@ class TestTeamParticipationTree(TeamParticipationTestCase): |
4089 | |
4090 | def setUp(self): |
4091 | """Setup the team hierarchy.""" |
4092 | - super(TestTeamParticipationTree, self).setUp() |
4093 | + super().setUp() |
4094 | self.team5.addMember(self.no_priv, self.foo_bar) |
4095 | self.team1.addMember(self.team2, self.foo_bar, force_team_add=True) |
4096 | self.team2.addMember(self.team3, self.foo_bar, force_team_add=True) |
4097 | @@ -445,7 +445,7 @@ class TestTeamParticipationTree(TeamParticipationTestCase): |
4098 | self.team4.addMember(self.team5, self.foo_bar, force_team_add=True) |
4099 | |
4100 | def tearDown(self): |
4101 | - super(TestTeamParticipationTree, self).tearDown() |
4102 | + super().tearDown() |
4103 | self.layer.force_dirty_database() |
4104 | |
4105 | def testTeamParticipationSetUp(self): |
4106 | @@ -510,7 +510,7 @@ class TestParticipationCleanup(TeamParticipationTestCase): |
4107 | |
4108 | def setUp(self): |
4109 | """Setup the team hierarchy.""" |
4110 | - super(TestParticipationCleanup, self).setUp() |
4111 | + super().setUp() |
4112 | self.team1.addMember(self.team2, self.foo_bar, force_team_add=True) |
4113 | self.team2.addMember(self.team3, self.foo_bar, force_team_add=True) |
4114 | self.team3.addMember(self.team4, self.foo_bar, force_team_add=True) |
4115 | @@ -547,7 +547,7 @@ class TestTeamParticipationMesh(TeamParticipationTestCase): |
4116 | |
4117 | def setUp(self): |
4118 | """Setup the team hierarchy.""" |
4119 | - super(TestTeamParticipationMesh, self).setUp() |
4120 | + super().setUp() |
4121 | self.team6 = getUtility(IPersonSet).newTeam( |
4122 | self.foo_bar, 'team6', 'team6') |
4123 | self.team5.addMember(self.no_priv, self.foo_bar) |
4124 | @@ -560,7 +560,7 @@ class TestTeamParticipationMesh(TeamParticipationTestCase): |
4125 | self.team6.addMember(self.team4, self.foo_bar, force_team_add=True) |
4126 | |
4127 | def tearDown(self): |
4128 | - super(TestTeamParticipationMesh, self).tearDown() |
4129 | + super().tearDown() |
4130 | self.layer.force_dirty_database() |
4131 | |
4132 | def testTeamParticipationSetUp(self): |
4133 | @@ -706,7 +706,7 @@ class TestTeamMembershipSetStatus(TestCaseWithFactory): |
4134 | layer = DatabaseFunctionalLayer |
4135 | |
4136 | def setUp(self): |
4137 | - super(TestTeamMembershipSetStatus, self).setUp() |
4138 | + super().setUp() |
4139 | login('foo.bar@canonical.com') |
4140 | self.foobar = getUtility(IPersonSet).getByName('name16') |
4141 | self.no_priv = getUtility(IPersonSet).getByName('no-priv') |
4142 | @@ -1015,7 +1015,7 @@ class TestTeamMembershipJobs(TestCaseWithFactory): |
4143 | self.useFixture(FeatureFixture({ |
4144 | 'jobs.celery.enabled_classes': 'RemoveArtifactSubscriptionsJob', |
4145 | })) |
4146 | - super(TestTeamMembershipJobs, self).setUp() |
4147 | + super().setUp() |
4148 | |
4149 | def _make_subscribed_bug(self, grantee, target, |
4150 | information_type=InformationType.USERDATA): |
4151 | @@ -1073,7 +1073,7 @@ class TestTeamMembershipSendExpirationWarningEmail(TestCaseWithFactory): |
4152 | layer = ZopelessDatabaseLayer |
4153 | |
4154 | def setUp(self): |
4155 | - super(TestTeamMembershipSendExpirationWarningEmail, self).setUp() |
4156 | + super().setUp() |
4157 | self.member = self.factory.makePerson(name='green') |
4158 | self.team = self.factory.makeTeam(name='red') |
4159 | login_person(self.team.teamowner) |
4160 | diff --git a/lib/lp/registry/tests/test_teammembership_webservice.py b/lib/lp/registry/tests/test_teammembership_webservice.py |
4161 | index 6edea51..81a1a09 100644 |
4162 | --- a/lib/lp/registry/tests/test_teammembership_webservice.py |
4163 | +++ b/lib/lp/registry/tests/test_teammembership_webservice.py |
4164 | @@ -20,7 +20,7 @@ class TestTeamMembershipTransitions(TestCaseWithFactory): |
4165 | layer = DatabaseFunctionalLayer |
4166 | |
4167 | def setUp(self): |
4168 | - super(TestTeamMembershipTransitions, self).setUp() |
4169 | + super().setUp() |
4170 | self.person = self.factory.makePerson(name='some-person') |
4171 | owner = self.factory.makePerson() |
4172 | self.team = self.factory.makeTeam( |
4173 | diff --git a/lib/lp/registry/tests/test_xmlrpc.py b/lib/lp/registry/tests/test_xmlrpc.py |
4174 | index fccd0bf..140e6b2 100644 |
4175 | --- a/lib/lp/registry/tests/test_xmlrpc.py |
4176 | +++ b/lib/lp/registry/tests/test_xmlrpc.py |
4177 | @@ -41,7 +41,7 @@ class TestCanonicalSSOApplication(TestCaseWithFactory): |
4178 | layer = DatabaseFunctionalLayer |
4179 | |
4180 | def setUp(self): |
4181 | - super(TestCanonicalSSOApplication, self).setUp() |
4182 | + super().setUp() |
4183 | self.rpc_proxy = xmlrpc.client.ServerProxy( |
4184 | 'http://xmlrpc-private.launchpad.test:8087/canonicalsso', |
4185 | transport=XMLRPCTestTransport()) |
4186 | @@ -87,7 +87,7 @@ class TestMailingListXMLRPC(TestCaseWithFactory): |
4187 | layer = DatabaseFunctionalLayer |
4188 | |
4189 | def setUp(self): |
4190 | - super(TestMailingListXMLRPC, self).setUp() |
4191 | + super().setUp() |
4192 | self.rpc_proxy = xmlrpc.client.ServerProxy( |
4193 | 'http://xmlrpc-private.launchpad.test:8087/mailinglists', |
4194 | transport=XMLRPCTestTransport()) |
4195 | @@ -146,7 +146,7 @@ class TestMailingListXMLRPCMessage(TestCaseWithFactory): |
4196 | layer = LaunchpadFunctionalLayer |
4197 | |
4198 | def setUp(self): |
4199 | - super(TestMailingListXMLRPCMessage, self).setUp() |
4200 | + super().setUp() |
4201 | self.rpc_proxy = xmlrpc.client.ServerProxy( |
4202 | 'http://xmlrpc-private.launchpad.test:8087/mailinglists', |
4203 | transport=XMLRPCTestTransport()) |
4204 | diff --git a/lib/lp/registry/vocabularies.py b/lib/lp/registry/vocabularies.py |
4205 | index d01a9b9..045cb4e 100644 |
4206 | --- a/lib/lp/registry/vocabularies.py |
4207 | +++ b/lib/lp/registry/vocabularies.py |
4208 | @@ -491,7 +491,7 @@ class PersonAccountToMergeVocabulary( |
4209 | def __contains__(self, obj): |
4210 | return obj in self._select() |
4211 | |
4212 | - def _select(self, text=u""): |
4213 | + def _select(self, text=""): |
4214 | """Return `IPerson` objects that match the text.""" |
4215 | return getUtility(IPersonSet).findPerson( |
4216 | text, exclude_inactive_accounts=False, |
4217 | @@ -902,7 +902,7 @@ class AllUserTeamsParticipationVocabulary(ValidTeamVocabulary): |
4218 | displayname = 'Select a Team of which you are a member' |
4219 | |
4220 | def __init__(self, context): |
4221 | - super(AllUserTeamsParticipationVocabulary, self).__init__(context) |
4222 | + super().__init__(context) |
4223 | user = getUtility(ILaunchBag).user |
4224 | if user is None: |
4225 | self.extra_clause = False |
4226 | @@ -970,7 +970,7 @@ class NewPillarGranteeVocabulary(ValidPersonOrExclusiveTeamVocabulary): |
4227 | |
4228 | def __init__(self, context): |
4229 | assert IPillar.providedBy(context) |
4230 | - super(NewPillarGranteeVocabulary, self).__init__(context) |
4231 | + super().__init__(context) |
4232 | aps = getUtility(IAccessPolicySource) |
4233 | access_policies = aps.findByPillar([self.context]) |
4234 | self.policy_ids = [policy.id for policy in access_policies] |
4235 | @@ -985,7 +985,7 @@ class NewPillarGranteeVocabulary(ValidPersonOrExclusiveTeamVocabulary): |
4236 | """ % sqlvalues(self.policy_ids)) |
4237 | return And( |
4238 | clause, |
4239 | - super(NewPillarGranteeVocabulary, self).extra_clause) |
4240 | + super().extra_clause) |
4241 | |
4242 | |
4243 | @implementer(IHugeVocabulary) |
4244 | @@ -1081,17 +1081,14 @@ class UserTeamsParticipationPlusSelfVocabulary( |
4245 | def __iter__(self): |
4246 | logged_in_user = getUtility(ILaunchBag).user |
4247 | yield self.toTerm(logged_in_user) |
4248 | - super_class = super(UserTeamsParticipationPlusSelfVocabulary, self) |
4249 | - for person in super_class.__iter__(): |
4250 | - yield person |
4251 | + yield from super().__iter__() |
4252 | |
4253 | def getTermByToken(self, token): |
4254 | """See `IVocabularyTokenized`.""" |
4255 | logged_in_user = getUtility(ILaunchBag).user |
4256 | if logged_in_user.name == token: |
4257 | return self.getTerm(logged_in_user) |
4258 | - super_class = super(UserTeamsParticipationPlusSelfVocabulary, self) |
4259 | - return super_class.getTermByToken(token) |
4260 | + return super().getTermByToken(token) |
4261 | |
4262 | |
4263 | class AllUserTeamsParticipationPlusSelfVocabulary( |
4264 | @@ -1106,8 +1103,7 @@ class AllUserTeamsParticipationPlusSelfVocabulary( |
4265 | INCLUDE_PRIVATE_TEAM = True |
4266 | |
4267 | def __init__(self, context=None): |
4268 | - super_class = super(AllUserTeamsParticipationPlusSelfVocabulary, self) |
4269 | - super_class.__init__(context) |
4270 | + super().__init__(context) |
4271 | if IBranch.providedBy(context): |
4272 | self.EXCLUSIVE_TEAMS_ONLY = ( |
4273 | len(list(context.associatedProductSeries())) > 0) |
4274 | @@ -1428,7 +1424,7 @@ class MilestoneWithDateExpectedVocabulary(MilestoneVocabulary): |
4275 | |
4276 | def toTerm(self, obj): |
4277 | """See `IVocabulary`.""" |
4278 | - term = super(MilestoneWithDateExpectedVocabulary, self).toTerm(obj) |
4279 | + term = super().toTerm(obj) |
4280 | if obj.dateexpected: |
4281 | formatter = DateTimeFormatterAPI(obj.dateexpected) |
4282 | term.title += ' (%s)' % formatter.approximatedate() |
4283 | @@ -1852,8 +1848,7 @@ class PillarVocabularyBase(NamedStormHugeVocabulary): |
4284 | def getTermByToken(self, token): |
4285 | """See `IVocabularyTokenized`.""" |
4286 | # Pillar names are always lowercase. |
4287 | - return super(PillarVocabularyBase, self).getTermByToken( |
4288 | - token.lower()) |
4289 | + return super().getTermByToken(token.lower()) |
4290 | |
4291 | def __contains__(self, obj): |
4292 | raise NotImplementedError |
4293 | @@ -2019,8 +2014,7 @@ class SourcePackageNameVocabulary(NamedStormHugeVocabulary): |
4294 | def getTermByToken(self, token): |
4295 | """See `IVocabularyTokenized`.""" |
4296 | # Package names are always lowercase. |
4297 | - return super(SourcePackageNameVocabulary, self).getTermByToken( |
4298 | - token.lower()) |
4299 | + return super().getTermByToken(token.lower()) |
4300 | |
4301 | |
4302 | @implementer(IHugeVocabulary) |
4303 | @@ -2217,7 +2211,7 @@ class OCIProjectVocabulary(StormVocabularyBase): |
4304 | step_title = 'Search' |
4305 | |
4306 | def __init__(self, context=None): |
4307 | - super(OCIProjectVocabulary, self).__init__(context) |
4308 | + super().__init__(context) |
4309 | self.pillar = None |
4310 | |
4311 | def setPillar(self, pillar): |
4312 | @@ -2240,7 +2234,7 @@ class OCIProjectVocabulary(StormVocabularyBase): |
4313 | |
4314 | @property |
4315 | def _entries(self): |
4316 | - return getUtility(IOCIProjectSet).searchByName(u'') |
4317 | + return getUtility(IOCIProjectSet).searchByName('') |
4318 | |
4319 | def __contains__(self, obj): |
4320 | found_obj = IStore(self._table).find( |
4321 | @@ -2258,7 +2252,7 @@ class DistributionPackageVocabulary: |
4322 | """ |
4323 | |
4324 | def __init__(self, context=None): |
4325 | - super(DistributionPackageVocabulary, self).__init__() |
4326 | + super().__init__() |
4327 | if bool(getFeatureFlag('disclosure.dsp_picker.enabled')): |
4328 | # Replace the default field with a field that uses the better |
4329 | # vocabulary. |
Self-approving (mechanical).