launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27862
[Merge] ~cjwatson/launchpad:pyupgrade-py3-registry-3 into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:pyupgrade-py3-registry-3 into launchpad:master.
Commit message:
lp.registry: Apply "pyupgrade --py3-plus"
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/413511
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:pyupgrade-py3-registry-3 into launchpad:master.
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index a7862ac..970ac3b 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -32,3 +32,5 @@ fbed83f22424df8fa5647349493f78937a520db5
9c1665b1dfed3f6abf69afa192700172ea3089a1
# apply pyupgrade --py3-plus to lp.registry.{interfaces,model,scripts}
94fc9e2ad28375faa98c524f66768a0b57a4b821
+# apply pyupgrade --py3-plus to lp.registry
+7c02bb8d73dd3875e338ba7945d3f7f86d1fc743
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index a9e2726..9b69a4f 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -52,7 +52,7 @@ repos:
|codehosting
|coop
|oci
- |registry/(browser|interfaces|model|scripts)
+ |registry
)/
- repo: https://github.com/PyCQA/isort
rev: 5.9.2
diff --git a/lib/lp/registry/mail/notification.py b/lib/lp/registry/mail/notification.py
index 909e37d..ad9e73a 100644
--- a/lib/lp/registry/mail/notification.py
+++ b/lib/lp/registry/mail/notification.py
@@ -195,14 +195,14 @@ def send_direct_contact_email(
# uses those anyway!? The only alternative is to attach the footer as a
# MIME attachment with a us-ascii charset, but that has it's own set of
# problems (and user complaints). Email sucks.
- additions = u'\n'.join([
- u'',
- u'-- ',
- u'This message was sent from Launchpad by',
- u'%s (%s)' % (sender_name, canonical_url(sender)),
- u'%s.',
- u'For more information see',
- u'https://help.launchpad.net/YourAccount/ContactingPeople',
+ additions = '\n'.join([
+ '',
+ '-- ',
+ 'This message was sent from Launchpad by',
+ '%s (%s)' % (sender_name, canonical_url(sender)),
+ '%s.',
+ 'For more information see',
+ 'https://help.launchpad.net/YourAccount/ContactingPeople',
])
# Craft and send one message per recipient.
mailwrapper = MailWrapper(width=72)
diff --git a/lib/lp/registry/mail/teammembership.py b/lib/lp/registry/mail/teammembership.py
index 452ca59..926d88d 100644
--- a/lib/lp/registry/mail/teammembership.py
+++ b/lib/lp/registry/mail/teammembership.py
@@ -82,8 +82,7 @@ class TeamMembershipRecipientReason(RecipientReason):
def __init__(self, subscriber, recipient, mail_header, reason_template,
subject=None, template_name=None, reply_to=None,
recipient_class=None):
- super(TeamMembershipRecipientReason, self).__init__(
- subscriber, recipient, mail_header, reason_template)
+ super().__init__(subscriber, recipient, mail_header, reason_template)
self.subject = subject
self.template_name = template_name
self.reply_to = reply_to
@@ -364,7 +363,7 @@ class TeamMembershipMailer(BaseMailer):
notification_type, member, team, reviewer, membership=None,
extra_params={}, wrap=True, force_wrap=True):
"""See `BaseMailer`."""
- super(TeamMembershipMailer, self).__init__(
+ super().__init__(
subject, template_name, recipients, from_address,
notification_type=notification_type, wrap=wrap,
force_wrap=force_wrap)
@@ -399,8 +398,7 @@ class TeamMembershipMailer(BaseMailer):
def _getTemplateParams(self, email, recipient):
"""See `BaseMailer`."""
- params = super(TeamMembershipMailer, self)._getTemplateParams(
- email, recipient)
+ params = super()._getTemplateParams(email, recipient)
params["recipient"] = recipient.displayname
reason, _ = self._recipients.getReason(email)
if reason.recipient_class is not None:
diff --git a/lib/lp/registry/personmerge.py b/lib/lp/registry/personmerge.py
index 9c39b76..2cef92b 100644
--- a/lib/lp/registry/personmerge.py
+++ b/lib/lp/registry/personmerge.py
@@ -1037,11 +1037,11 @@ def merge_people(from_person, to_person, reviewer, delete=False):
if to_person.is_team:
mail_text = get_email_template(
'team-merged.txt', app='registry')
- subject = u'Launchpad teams merged'
+ subject = 'Launchpad teams merged'
else:
mail_text = get_email_template(
'person-merged.txt', app='registry')
- subject = u'Launchpad accounts merged'
+ subject = 'Launchpad accounts merged'
mail_text = mail_text % {
'dupename': from_person.name,
'person': to_person.name,
diff --git a/lib/lp/registry/services/sharingservice.py b/lib/lp/registry/services/sharingservice.py
index 7384df4..dda0934 100644
--- a/lib/lp/registry/services/sharingservice.py
+++ b/lib/lp/registry/services/sharingservice.py
@@ -12,7 +12,6 @@ from operator import attrgetter
from lazr.restful.interfaces import IWebBrowserOriginatingRequest
from lazr.restful.utils import get_current_web_service_request
-import six
from storm.expr import (
And,
Count,
@@ -679,7 +678,7 @@ class SharingService:
for (grantee, permissions, shared_artifact_types) in grant_permissions:
some_things_shared = len(shared_artifact_types) > 0
grantee_permissions = {}
- for (policy, permission) in six.iteritems(permissions):
+ for (policy, permission) in permissions.items():
grantee_permissions[policy.type.name] = permission.name
shared_artifact_type_names = [
info_type.name for info_type in shared_artifact_types]
diff --git a/lib/lp/registry/services/tests/test_sharingservice.py b/lib/lp/registry/services/tests/test_sharingservice.py
index e0accd8..858dfd3 100644
--- a/lib/lp/registry/services/tests/test_sharingservice.py
+++ b/lib/lp/registry/services/tests/test_sharingservice.py
@@ -68,7 +68,7 @@ class TestSharingService(TestCaseWithFactory, OCIConfigHelperMixin):
layer = CeleryJobLayer
def setUp(self):
- super(TestSharingService, self).setUp()
+ super().setUp()
self.service = getUtility(IService, 'sharing')
# Set test flags and configurations for Snaps and OCI.
flags = SNAP_TESTING_FLAGS.copy()
@@ -2004,7 +2004,7 @@ class ApiTestMixin:
"""Common tests for launchpadlib and webservice."""
def setUp(self):
- super(ApiTestMixin, self).setUp()
+ super().setUp()
self.owner = self.factory.makePerson(name='thundercat')
self.pillar = self.factory.makeProduct(
owner=self.owner, specification_sharing_policy=(
@@ -2055,7 +2055,7 @@ class TestWebService(ApiTestMixin, WebServiceTestCase):
"""Test the web service interface for the Sharing Service."""
def setUp(self):
- super(TestWebService, self).setUp()
+ super().setUp()
self.webservice = LaunchpadWebServiceCaller(
'launchpad-library', 'salgado-change-anything')
self._sharePillarInformation(self.pillar)
@@ -2102,7 +2102,7 @@ class TestLaunchpadlib(ApiTestMixin, TestCaseWithFactory):
layer = AppServerLayer
def setUp(self):
- super(TestLaunchpadlib, self).setUp()
+ super().setUp()
self.launchpad = self.factory.makeLaunchpadService(person=self.owner)
self.service = self.launchpad.load('+services/sharing')
transaction.commit()
diff --git a/lib/lp/registry/tests/mailinglists_helper.py b/lib/lp/registry/tests/mailinglists_helper.py
index 20ace5c..a6d53d5 100644
--- a/lib/lp/registry/tests/mailinglists_helper.py
+++ b/lib/lp/registry/tests/mailinglists_helper.py
@@ -112,27 +112,24 @@ class MailingListXMLRPCTestProxy(MailingListAPIView):
@fault_catcher
def getPendingActions(self):
- return super(MailingListXMLRPCTestProxy, self).getPendingActions()
+ return super().getPendingActions()
@fault_catcher
def reportStatus(self, statuses):
- return super(MailingListXMLRPCTestProxy, self).reportStatus(statuses)
+ return super().reportStatus(statuses)
@fault_catcher
def getMembershipInformation(self, teams):
- return super(
- MailingListXMLRPCTestProxy, self).getMembershipInformation(teams)
+ return super().getMembershipInformation(teams)
@fault_catcher
def isLaunchpadMember(self, address):
- return super(MailingListXMLRPCTestProxy, self).isLaunchpadMember(
- address)
+ return super().isLaunchpadMember(address)
@fault_catcher
def isTeamPublic(self, team_name):
- return super(MailingListXMLRPCTestProxy, self).isTeamPublic(team_name)
+ return super().isTeamPublic(team_name)
@fault_catcher
def updateTeamAddresses(self, old_hostname):
- return super(MailingListXMLRPCTestProxy, self).updateTeamAddresses(
- old_hostname)
+ return super().updateTeamAddresses(old_hostname)
diff --git a/lib/lp/registry/tests/test_accesspolicy.py b/lib/lp/registry/tests/test_accesspolicy.py
index 99b6145..93d7d7f 100644
--- a/lib/lp/registry/tests/test_accesspolicy.py
+++ b/lib/lp/registry/tests/test_accesspolicy.py
@@ -552,7 +552,7 @@ class TestAccessPolicyGrantFlatSource(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestAccessPolicyGrantFlatSource, self).setUp()
+ super().setUp()
self.apgfs = getUtility(IAccessPolicyGrantFlatSource)
def _makePolicyGrants(self):
diff --git a/lib/lp/registry/tests/test_add_member.py b/lib/lp/registry/tests/test_add_member.py
index ec6748e..00fb26e 100644
--- a/lib/lp/registry/tests/test_add_member.py
+++ b/lib/lp/registry/tests/test_add_member.py
@@ -15,7 +15,7 @@ class CircularMemberAdditionTestCase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(CircularMemberAdditionTestCase, self).setUp()
+ super().setUp()
self.a_team = self.factory.makeTeam(name="a")
self.b_team = self.factory.makeTeam(name="b")
diff --git a/lib/lp/registry/tests/test_codeofconduct.py b/lib/lp/registry/tests/test_codeofconduct.py
index cc61593..b9b8fed 100644
--- a/lib/lp/registry/tests/test_codeofconduct.py
+++ b/lib/lp/registry/tests/test_codeofconduct.py
@@ -230,7 +230,7 @@ class TestSignedCodeOfConductSet(TestCaseWithFactory):
def test_affirmAndStore_incorrect_text(self):
user = self.factory.makePerson()
self.assertEqual(
- u"The affirmed text does not match the current Code of Conduct.",
+ "The affirmed text does not match the current Code of Conduct.",
getUtility(ISignedCodeOfConductSet).affirmAndStore(user, "foo"))
def test_affirmAndStore_existing(self):
@@ -241,7 +241,7 @@ class TestSignedCodeOfConductSet(TestCaseWithFactory):
user, current.content))
self.assertEqual(
- u"You have already affirmed the current Code of Conduct.",
+ "You have already affirmed the current Code of Conduct.",
getUtility(ISignedCodeOfConductSet).affirmAndStore(
user, current.content))
diff --git a/lib/lp/registry/tests/test_commercialprojects_vocabularies.py b/lib/lp/registry/tests/test_commercialprojects_vocabularies.py
index a594d0c..6bdafd9 100644
--- a/lib/lp/registry/tests/test_commercialprojects_vocabularies.py
+++ b/lib/lp/registry/tests/test_commercialprojects_vocabularies.py
@@ -20,7 +20,7 @@ class TestCommProjVocabulary(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestCommProjVocabulary, self).setUp()
+ super().setUp()
self.owner = self.factory.makePerson(
email_address_status=EmailAddressStatus.VALIDATED)
self._createProjects()
@@ -61,25 +61,25 @@ class TestCommProjVocabulary(TestCaseWithFactory):
def test_searchForTerms_success(self):
# Search for active maintained projects success.
- results = self.vocab.searchForTerms(u'widget')
+ results = self.vocab.searchForTerms('widget')
self.assertEqual(
self.num_commercial, len(results),
"Expected %d results but got %d." % (self.num_commercial,
len(results)))
# Ensure we get only those that match by searching for a single
# widget, using 't1', a subset of the name 'widget1'.
- results = self.vocab.searchForTerms(u't1')
+ results = self.vocab.searchForTerms('t1')
self.assertEqual(1, len(results),
"Expected %d result but got %d." % (1, len(results)))
def test_searchForTerms_fail(self):
# Search for deactivated or non-maintained projects fails.
- results = self.vocab.searchForTerms(u'norwegian-blue-widget')
+ results = self.vocab.searchForTerms('norwegian-blue-widget')
self.assertEqual(0, len(results),
"Expected %d results but got %d." %
(0, len(results)))
- results = self.vocab.searchForTerms(u'firefox')
+ results = self.vocab.searchForTerms('firefox')
self.assertEqual(0, len(results),
"Expected %d results but got %d." %
(0, len(results)))
@@ -89,9 +89,9 @@ class TestCommProjVocabulary(TestCaseWithFactory):
expert = login_celebrity('commercial_admin')
self.vocab = CommercialProjectsVocabulary(context=expert)
self.assertEqual(
- 1, len(self.vocab.searchForTerms(u'open-widget')))
+ 1, len(self.vocab.searchForTerms('open-widget')))
self.assertEqual(
- 0, len(self.vocab.searchForTerms(u'norwegian-blue-widget')))
+ 0, len(self.vocab.searchForTerms('norwegian-blue-widget')))
def test_toTerm(self):
# Commercial project terms contain subscription information.
@@ -103,27 +103,27 @@ class TestCommProjVocabulary(TestCaseWithFactory):
def test_getTermByToken_user(self):
# The term for a token in the vocabulary is returned for maintained
# projects.
- token = self.vocab.getTermByToken(u'open-widget')
+ token = self.vocab.getTermByToken('open-widget')
self.assertEqual(self.maintained_project, token.value)
def test_getTermByToken_commercial_admin(self):
# The term for a token in the vocabulary is returned for any
# active project.
login_celebrity('commercial_admin')
- token = self.vocab.getTermByToken(u'open-widget')
+ token = self.vocab.getTermByToken('open-widget')
self.assertEqual(self.maintained_project, token.value)
def test_getTermByToken_error_user(self):
# A LookupError is raised if the token is not in the vocabulary.
self.assertRaises(
- LookupError, self.vocab.getTermByToken, u'norwegian-blue-widget')
+ LookupError, self.vocab.getTermByToken, 'norwegian-blue-widget')
def test_getTermByToken_error_commercial_admin(self):
# The term for a token in the vocabulary is returned for any
# active project.
login_celebrity('commercial_admin')
self.assertRaises(
- LookupError, self.vocab.getTermByToken, u'norwegian-blue-widget')
+ LookupError, self.vocab.getTermByToken, 'norwegian-blue-widget')
def test_iter(self):
# The vocabulary can be iterated and the order is by displayname.
diff --git a/lib/lp/registry/tests/test_distribution.py b/lib/lp/registry/tests/test_distribution.py
index e19bde3..427d95e 100644
--- a/lib/lp/registry/tests/test_distribution.py
+++ b/lib/lp/registry/tests/test_distribution.py
@@ -107,7 +107,7 @@ class TestDistribution(TestCaseWithFactory):
def test_distribution_repr_ansii(self):
# Verify that ANSI displayname is ascii safe.
distro = self.factory.makeDistribution(
- name="distro", displayname=u'\xdc-distro')
+ name="distro", displayname='\xdc-distro')
ignore, displayname, name = repr(distro).rsplit(' ', 2)
self.assertEqual("'\\xdc-distro'", displayname)
self.assertEqual('(distro)>', name)
@@ -115,7 +115,7 @@ class TestDistribution(TestCaseWithFactory):
def test_distribution_repr_unicode(self):
# Verify that Unicode displayname is ascii safe.
distro = self.factory.makeDistribution(
- name="distro", displayname=u'\u0170-distro')
+ name="distro", displayname='\u0170-distro')
ignore, displayname, name = repr(distro).rsplit(' ', 2)
self.assertEqual("'\\u0170-distro'", displayname)
@@ -334,14 +334,14 @@ class TestDistribution(TestCaseWithFactory):
self.assertEqual(first_project, result[0])
def test_searchOCIProjects_by_partial_name(self):
- name = u'testpartialname'
+ name = 'testpartialname'
distro = self.factory.makeDistribution()
first_name = self.factory.makeOCIProjectName(name=name)
first_project = self.factory.makeOCIProject(
pillar=distro, ociprojectname=first_name)
self.factory.makeOCIProject(pillar=distro)
- result = distro.searchOCIProjects(text=u'partial')
+ result = distro.searchOCIProjects(text='partial')
self.assertEqual(1, result.count())
self.assertEqual(first_project, result[0])
@@ -518,7 +518,7 @@ class DistroSnapshotTestCase(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(DistroSnapshotTestCase, self).setUp()
+ super().setUp()
self.distribution = self.factory.makeDistribution(name="boobuntu")
def test_snapshot(self):
@@ -546,9 +546,9 @@ class TestDistributionPage(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistributionPage, self).setUp('foo.bar@xxxxxxxxxxxxx')
+ super().setUp('foo.bar@xxxxxxxxxxxxx')
self.distro = self.factory.makeDistribution(
- name="distro", displayname=u'distro')
+ name="distro", displayname='distro')
self.admin = getUtility(IPersonSet).getByEmail(
'admin@xxxxxxxxxxxxx')
self.simple_user = self.factory.makePerson()
@@ -627,7 +627,7 @@ class DistroRegistrantTestCase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(DistroRegistrantTestCase, self).setUp()
+ super().setUp()
self.owner = self.factory.makePerson()
self.registrant = self.factory.makePerson()
@@ -768,7 +768,7 @@ class TestDistributionWebservice(OCIConfigHelperMixin, TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistributionWebservice, self).setUp()
+ super().setUp()
self.person = self.factory.makePerson(
displayname="Test Person")
self.webservice = webservice_for_person(
@@ -776,7 +776,7 @@ class TestDistributionWebservice(OCIConfigHelperMixin, TestCaseWithFactory):
default_api_version="devel")
def test_searchOCIProjects(self):
- name = self.factory.getUniqueUnicode(u"partial-")
+ name = self.factory.getUniqueUnicode("partial-")
with person_logged_in(self.person):
distro = self.factory.makeDistribution(owner=self.person)
first_name = self.factory.makeOCIProjectName(name=name)
@@ -804,7 +804,7 @@ class TestDistributionWebservice(OCIConfigHelperMixin, TestCaseWithFactory):
with person_logged_in(self.person):
distro = self.factory.makeDistribution()
self.factory.makeQuestion(
- title=u"Crash with %s" % oopsid, target=distro)
+ title="Crash with %s" % oopsid, target=distro)
distro_url = api_url(distro)
now = datetime.datetime.now(tz=pytz.utc)
@@ -829,7 +829,7 @@ class TestDistributionWebservice(OCIConfigHelperMixin, TestCaseWithFactory):
# check the filter is tight enough - other contexts should not work.
oopsid = "OOPS-abcdef1234"
with person_logged_in(self.person):
- self.factory.makeQuestion(title=u"Crash with %s" % oopsid)
+ self.factory.makeQuestion(title="Crash with %s" % oopsid)
distro = self.factory.makeDistribution()
distro_url = api_url(distro)
now = datetime.datetime.now(tz=pytz.utc)
diff --git a/lib/lp/registry/tests/test_distributionmirror.py b/lib/lp/registry/tests/test_distributionmirror.py
index 8f1423d..e638311 100644
--- a/lib/lp/registry/tests/test_distributionmirror.py
+++ b/lib/lp/registry/tests/test_distributionmirror.py
@@ -32,7 +32,7 @@ class TestDistributionMirror(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(TestDistributionMirror, self).setUp()
+ super().setUp()
login('test@xxxxxxxxxxxxx')
mirrorset = getUtility(IDistributionMirrorSet)
self.cdimage_mirror = mirrorset.getByName('releases-mirror')
diff --git a/lib/lp/registry/tests/test_distributionmirror_prober.py b/lib/lp/registry/tests/test_distributionmirror_prober.py
index 0146ca4..8b9fd22 100644
--- a/lib/lp/registry/tests/test_distributionmirror_prober.py
+++ b/lib/lp/registry/tests/test_distributionmirror_prober.py
@@ -133,8 +133,7 @@ class LocalhostWhitelistedHTTPSPolicy(BrowserLikePolicyForHTTPS):
# otherwise return the default policy
if hostname == b'localhost':
return ssl.CertificateOptions(verify=False)
- return super(LocalhostWhitelistedHTTPSPolicy, self).creatorForNetloc(
- hostname, port)
+ return super().creatorForNetloc(hostname, port)
class TestURLParser(TestCase):
@@ -162,7 +161,7 @@ class TestProberHTTPSProtocolAndFactory(TestCase):
timeout=30)
def setUp(self):
- super(TestProberHTTPSProtocolAndFactory, self).setUp()
+ super().setUp()
root = DistributionMirrorTestSecureHTTPServer()
site = server.Site(root)
site.displayTracebacks = False
@@ -184,10 +183,10 @@ class TestProberHTTPSProtocolAndFactory(TestCase):
self.port = self.listening_port.getHost().port
- self.urls = {'timeout': u'https://localhost:%s/timeout' % self.port,
- '200': u'https://localhost:%s/valid-mirror' % self.port,
- '500': u'https://localhost:%s/error' % self.port,
- '404': u'https://localhost:%s/invalid-mirror' % self.port}
+ self.urls = {'timeout': 'https://localhost:%s/timeout' % self.port,
+ '200': 'https://localhost:%s/valid-mirror' % self.port,
+ '500': 'https://localhost:%s/error' % self.port,
+ '404': 'https://localhost:%s/invalid-mirror' % self.port}
self.pushConfig('launchpad', http_proxy=None)
self.useFixture(MockPatchObject(
@@ -309,17 +308,17 @@ class TestProberProtocolAndFactory(TestCase):
timeout=30)
def setUp(self):
- super(TestProberProtocolAndFactory, self).setUp()
+ super().setUp()
root = DistributionMirrorTestHTTPServer()
site = server.Site(root)
site.displayTracebacks = False
self.listening_port = reactor.listenTCP(0, site)
self.addCleanup(self.listening_port.stopListening)
self.port = self.listening_port.getHost().port
- self.urls = {'timeout': u'http://localhost:%s/timeout' % self.port,
- '200': u'http://localhost:%s/valid-mirror' % self.port,
- '500': u'http://localhost:%s/error' % self.port,
- '404': u'http://localhost:%s/invalid-mirror' % self.port}
+ self.urls = {'timeout': 'http://localhost:%s/timeout' % self.port,
+ '200': 'http://localhost:%s/valid-mirror' % self.port,
+ '500': 'http://localhost:%s/error' % self.port,
+ '404': 'http://localhost:%s/invalid-mirror' % self.port}
self.pushConfig('launchpad', http_proxy=None)
def _createProberAndProbe(self, url):
@@ -525,7 +524,7 @@ class TestProberFactoryRequestTimeoutRatioWithoutTwisted(TestCase):
host = 'foo.bar'
def setUp(self):
- super(TestProberFactoryRequestTimeoutRatioWithoutTwisted, self).setUp()
+ super().setUp()
self.orig_host_requests = dict(
distributionmirror_prober.host_requests)
self.orig_host_timeouts = dict(
@@ -537,9 +536,7 @@ class TestProberFactoryRequestTimeoutRatioWithoutTwisted(TestCase):
distributionmirror_prober.host_timeouts = self.orig_host_timeouts
# We need to remove any DelayedCalls that didn't actually get called.
clean_up_reactor()
- super(
- TestProberFactoryRequestTimeoutRatioWithoutTwisted,
- self).tearDown()
+ super().tearDown()
def _createProberStubConnectAndProbe(self, requests, timeouts):
"""Create a ProberFactory object with a URL inside self.host and call
@@ -615,7 +612,7 @@ class TestProberFactoryRequestTimeoutRatioWithTwisted(TestCase):
run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=30)
def setUp(self):
- super(TestProberFactoryRequestTimeoutRatioWithTwisted, self).setUp()
+ super().setUp()
orig_host_requests = dict(distributionmirror_prober.host_requests)
orig_host_timeouts = dict(distributionmirror_prober.host_timeouts)
distributionmirror_prober.host_requests = {}
@@ -643,7 +640,7 @@ class TestProberFactoryRequestTimeoutRatioWithTwisted(TestCase):
def test_timeout_is_recorded(self):
host = 'localhost'
d = self._createProberAndProbe(
- u'http://%s:%s/timeout' % (host, self.port))
+ 'http://%s:%s/timeout' % (host, self.port))
def got_error(error):
self.assertEqual(
@@ -656,7 +653,7 @@ class TestProberFactoryRequestTimeoutRatioWithTwisted(TestCase):
def test_non_timeout_is_recorded(self):
host = 'localhost'
d = self._createProberAndProbe(
- u'http://%s:%s/valid-mirror' % (host, self.port))
+ 'http://%s:%s/valid-mirror' % (host, self.port))
def got_result(result):
self.assertEqual(
@@ -678,14 +675,14 @@ class TestProberFactoryRequestTimeoutRatioWithTwisted(TestCase):
self.assertTrue(should_skip_host(host))
d = self._createProberAndProbe(
- u'http://%s:%s/timeout' % (host, self.port))
+ 'http://%s:%s/timeout' % (host, self.port))
return assert_fails_with(d, ConnectionSkipped)
class TestMultiLock(TestCase):
def setUp(self):
- super(TestMultiLock, self).setUp()
+ super().setUp()
self.lock_one = defer.DeferredLock()
self.lock_two = defer.DeferredLock()
self.multi_lock = MultiLock(self.lock_one, self.lock_two)
@@ -767,7 +764,7 @@ class TestRedirectAwareProberFactoryAndProtocol(TestCase):
def tearDown(self):
# We need to remove any DelayedCalls that didn't actually get called.
clean_up_reactor()
- super(TestRedirectAwareProberFactoryAndProtocol, self).tearDown()
+ super().tearDown()
def test_redirect_resets_timeout(self):
prober = RedirectAwareProberFactory('http://foo.bar')
@@ -1052,7 +1049,7 @@ class TestProbeFunctionSemaphores(TestCase):
layer = ZopelessDatabaseLayer
def setUp(self):
- super(TestProbeFunctionSemaphores, self).setUp()
+ super().setUp()
self.logger = None
# RequestManager uses a mutable class attribute (host_locks) to ensure
# all of its instances share the same locks. We don't want our tests
@@ -1063,7 +1060,7 @@ class TestProbeFunctionSemaphores(TestCase):
def tearDown(self):
# We need to remove any DelayedCalls that didn't actually get called.
clean_up_reactor()
- super(TestProbeFunctionSemaphores, self).tearDown()
+ super().tearDown()
def test_MirrorCDImageSeries_records_are_deleted_before_probing(self):
mirror = DistributionMirror.byName('releases-mirror2')
@@ -1162,7 +1159,7 @@ class TestLoggingMixin(TestCase):
def tearDown(self):
# We need to remove any DelayedCalls that didn't actually get called.
clean_up_reactor()
- super(TestLoggingMixin, self).tearDown()
+ super().tearDown()
def _fake_gettime(self):
# Fake the current time.
@@ -1194,7 +1191,7 @@ class TestDistroMirrorProberFunctional(TestCaseWithFactory):
layer = LaunchpadZopelessLayer
def setUp(self):
- super(TestDistroMirrorProberFunctional, self).setUp()
+ super().setUp()
# Makes a clean distro mirror set, with only the mirrors we want.
self.removeMirrors()
diff --git a/lib/lp/registry/tests/test_distributionsourcepackage.py b/lib/lp/registry/tests/test_distributionsourcepackage.py
index df6052b..c9972dc 100644
--- a/lib/lp/registry/tests/test_distributionsourcepackage.py
+++ b/lib/lp/registry/tests/test_distributionsourcepackage.py
@@ -188,7 +188,7 @@ class TestDistributionSourcePackageFindRelatedArchives(TestCaseWithFactory):
def setUp(self):
"""Publish some gedit sources in main and PPAs."""
- super(TestDistributionSourcePackageFindRelatedArchives, self).setUp()
+ super().setUp()
self.distribution = getUtility(IDistributionSet)['ubuntutest']
diff --git a/lib/lp/registry/tests/test_distro_webservice.py b/lib/lp/registry/tests/test_distro_webservice.py
index f79e09e..32c60e0 100644
--- a/lib/lp/registry/tests/test_distro_webservice.py
+++ b/lib/lp/registry/tests/test_distro_webservice.py
@@ -47,7 +47,7 @@ class TestGetBranchTips(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestGetBranchTips, self).setUp()
+ super().setUp()
self.distro = self.factory.makeDistribution()
series_1 = self.series_1 = self.factory.makeDistroSeries(self.distro)
series_2 = self.series_2 = self.factory.makeDistroSeries(self.distro)
diff --git a/lib/lp/registry/tests/test_distroseries.py b/lib/lp/registry/tests/test_distroseries.py
index d67e499..d214f99 100644
--- a/lib/lp/registry/tests/test_distroseries.py
+++ b/lib/lp/registry/tests/test_distroseries.py
@@ -70,7 +70,7 @@ class CurrentSourceReleasesMixin:
"""
def setUp(self):
# Log in as an admin, so that we can create distributions.
- super(CurrentSourceReleasesMixin, self).setUp()
+ super().setUp()
login('foo.bar@xxxxxxxxxxxxx')
self.publisher = SoyuzTestPublisher()
self.factory = self.publisher.factory
@@ -428,7 +428,7 @@ class TestDistroSeriesPackaging(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistroSeriesPackaging, self).setUp()
+ super().setUp()
self.series = self.factory.makeDistroSeries()
self.user = self.series.distribution.owner
login('admin@xxxxxxxxxxxxx')
@@ -523,7 +523,7 @@ class TestDistroSeriesPackaging(TestCaseWithFactory):
package_summaries = self.series.getPrioritizedUnlinkedSourcePackages()
names = [summary['package'].name for summary in package_summaries]
expected = [
- u'main', u'hot-translatable', u'hot', u'translatable', u'normal']
+ 'main', 'hot-translatable', 'hot', 'translatable', 'normal']
self.assertEqual(expected, names)
def test_getPrioritizedUnlinkedSourcePackages_no_language_packs(self):
@@ -532,7 +532,7 @@ class TestDistroSeriesPackaging(TestCaseWithFactory):
package_summaries = self.series.getPrioritizedUnlinkedSourcePackages()
names = [summary['package'].name for summary in package_summaries]
expected = [
- u'main', u'hot-translatable', u'hot', u'translatable', u'normal']
+ 'main', 'hot-translatable', 'hot', 'translatable', 'normal']
self.assertEqual(expected, names)
def test_getPrioritizedPackagings(self):
@@ -542,7 +542,7 @@ class TestDistroSeriesPackaging(TestCaseWithFactory):
packagings = self.series.getPrioritizedPackagings()
names = [packaging.sourcepackagename.name for packaging in packagings]
expected = [
- u'main', u'hot-translatable', u'hot', u'translatable', u'linked']
+ 'main', 'hot-translatable', 'hot', 'translatable', 'linked']
self.assertEqual(expected, names)
def test_getPrioritizedPackagings_bug_tracker(self):
@@ -554,7 +554,7 @@ class TestDistroSeriesPackaging(TestCaseWithFactory):
product_series.product.bugtracker = self.factory.makeBugTracker()
packagings = self.series.getPrioritizedPackagings()
names = [packaging.sourcepackagename.name for packaging in packagings]
- expected = [u'hot', u'linked', u'cold']
+ expected = ['hot', 'linked', 'cold']
self.assertEqual(expected, names)
def test_getPrioritizedPackagings_branch(self):
@@ -566,7 +566,7 @@ class TestDistroSeriesPackaging(TestCaseWithFactory):
product_series.branch = self.factory.makeBranch()
packagings = self.series.getPrioritizedPackagings()
names = [packaging.sourcepackagename.name for packaging in packagings]
- expected = [u'translatable', u'linked', u'withbranch']
+ expected = ['translatable', 'linked', 'withbranch']
self.assertEqual(expected, names)
def test_getPrioritizedPackagings_translation(self):
@@ -581,7 +581,7 @@ class TestDistroSeriesPackaging(TestCaseWithFactory):
TranslationsBranchImportMode.IMPORT_TEMPLATES)
packagings = self.series.getPrioritizedPackagings()
names = [packaging.sourcepackagename.name for packaging in packagings]
- expected = [u'translatable', u'linked', u'importabletranslatable']
+ expected = ['translatable', 'linked', 'importabletranslatable']
self.assertEqual(expected, names)
def test_getSourcePackagePublishing_query_count(self):
@@ -687,7 +687,7 @@ class TestDistroSeriesSet(TestCaseWithFactory):
self.ref_translatables = self._get_translatables()
new_distroseries = (
- self.factory.makeDistroSeries(name=u"sampleseries"))
+ self.factory.makeDistroSeries(name="sampleseries"))
with person_logged_in(new_distroseries.distribution.owner):
new_distroseries.hide_all_translations = False
transaction.commit()
@@ -705,11 +705,11 @@ class TestDistroSeriesSet(TestCaseWithFactory):
transaction.commit()
translatables = self._get_translatables()
self.assertEqual(
- translatables, self._ref_translatables(u"sampleseries"),
+ translatables, self._ref_translatables("sampleseries"),
"After assigning a PO template, a distroseries should be "
"translatable but translatables() returns %r instead of %r." % (
translatables,
- self._ref_translatables(u"sampleseries")))
+ self._ref_translatables("sampleseries")))
with person_logged_in(new_distroseries.distribution.owner):
new_distroseries.hide_all_translations = True
diff --git a/lib/lp/registry/tests/test_distroseries_vocabularies.py b/lib/lp/registry/tests/test_distroseries_vocabularies.py
index c5c30b8..8f7cc1b 100644
--- a/lib/lp/registry/tests/test_distroseries_vocabularies.py
+++ b/lib/lp/registry/tests/test_distroseries_vocabularies.py
@@ -45,7 +45,7 @@ class TestDistroSeriesDerivationVocabulary(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistroSeriesDerivationVocabulary, self).setUp()
+ super().setUp()
self.all_distroseries = getUtility(IDistroSeriesSet).search()
self.all_series_with_arch = [
series for series in self.all_distroseries
diff --git a/lib/lp/registry/tests/test_distroseriesdifference.py b/lib/lp/registry/tests/test_distroseriesdifference.py
index 18bb640..46dd5df 100644
--- a/lib/lp/registry/tests/test_distroseriesdifference.py
+++ b/lib/lp/registry/tests/test_distroseriesdifference.py
@@ -863,7 +863,7 @@ class DistroSeriesDifferenceTestCase(TestCaseWithFactory):
# source_version with status PUBLISHED or PENDING.
dsp = self.factory.makeDistroSeriesParent()
source_package_name = self.factory.getOrMakeSourcePackageName('foo')
- versions = {'derived': u'1.2', 'parent': u'1.3'}
+ versions = {'derived': '1.2', 'parent': '1.3'}
ds_diff = self.factory.makeDistroSeriesDifference(
derived_series=dsp.derived_series,
@@ -1358,9 +1358,9 @@ class TestMostRecentPublications(TestCaseWithFactory):
# Create a new DistroSeriesDifference
version = self.factory.getUniqueInteger()
versions = {
- 'base': u'1.%d' % version,
- 'derived': u'1.%dderived1' % version,
- 'parent': u'1.%d-1' % version,
+ 'base': '1.%d' % version,
+ 'derived': '1.%dderived1' % version,
+ 'parent': '1.%d-1' % version,
}
dsd = self.factory.makeDistroSeriesDifference(
derived_series=derived_series,
@@ -1427,7 +1427,7 @@ class TestMostRecentPublications(TestCaseWithFactory):
dsd = self.create_difference(derived_series)
# Modify the release version.
removeSecurityProxy(
- dsd.source_package_release.sourcepackagerelease).version += u"2"
+ dsd.source_package_release.sourcepackagerelease).version += "2"
# Searching with match_version=False finds the publication.
self.assertContentEqual(
[(dsd.source_package_name.id, dsd.source_pub)],
diff --git a/lib/lp/registry/tests/test_initderiveddistroseries.py b/lib/lp/registry/tests/test_initderiveddistroseries.py
index ade4a6d..455135e 100644
--- a/lib/lp/registry/tests/test_initderiveddistroseries.py
+++ b/lib/lp/registry/tests/test_initderiveddistroseries.py
@@ -34,7 +34,7 @@ class TestDeriveDistroSeries(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(TestDeriveDistroSeries, self).setUp()
+ super().setUp()
self.parent = self.factory.makeDistroSeries()
arch = self.factory.makeDistroArchSeries(distroseries=self.parent)
removeSecurityProxy(self.parent).nominatedarchindep = arch
@@ -103,7 +103,7 @@ class TestDeriveDistroSeriesMultipleParents(InitializationHelperTestCase):
[parent1, parent2], child=child)
self.assertBinPackagesAndVersions(
child,
- [(u'p1', u'0.1-1'), (u'p2', u'2.1')])
+ [('p1', '0.1-1'), ('p2', '2.1')])
def test_multiple_parents_do_not_close_bugs(self):
# The initialization does not close the bugs on the copied
@@ -127,7 +127,7 @@ class TestDeriveDistroSeriesMultipleParents(InitializationHelperTestCase):
# Make sure the initialization was successful.
self.assertBinPackagesAndVersions(
child,
- [(u'p1', u'0.1-1'), (u'p2', u'2.1')])
+ [('p1', '0.1-1'), ('p2', '2.1')])
# Assert that close_bugs_for_sourcepublication has not been
# called.
self.assertEqual(
@@ -143,10 +143,10 @@ class TestDeriveDistroSeriesMultipleParents(InitializationHelperTestCase):
parent, parent_das = self.setupParent()
# Create packageset p1 with a build.
p1, packageset1, unsed = self.createPackageInPackageset(
- parent, u'p1', u'packageset1', True)
+ parent, 'p1', 'packageset1', True)
# Create packageset p2 without a build.
p2, packageset2, unsed = self.createPackageInPackageset(
- parent, u'p2', u'packageset2', False)
+ parent, 'p2', 'packageset2', False)
child = self.factory.makeDistroSeries(
distribution=parent.distribution, previous_series=parent)
diff --git a/lib/lp/registry/tests/test_listteammembers.py b/lib/lp/registry/tests/test_listteammembers.py
index f3e52e1..4f2e4ff 100644
--- a/lib/lp/registry/tests/test_listteammembers.py
+++ b/lib/lp/registry/tests/test_listteammembers.py
@@ -7,52 +7,52 @@ from lp.testing.layers import LaunchpadZopelessLayer
ubuntuteam_default = sorted([
- u'cprov, celso.providelo@xxxxxxxxxxxxx',
- u'edgar, edgar@xxxxxxxxxxxxxxxx',
- u'jdub, jeff.waugh@xxxxxxxxxxxxxxx',
- u'kamion, colin.watson@xxxxxxxxxxxxxxx',
- u'kinnison, daniel.silverstone@xxxxxxxxxxxxx',
- u'limi, limi@xxxxxxxxx',
- u'name16, foo.bar@xxxxxxxxxxxxx',
- u'mark, mark@xxxxxxxxxxx',
- u'stevea, steve.alexander@xxxxxxxxxxxxxxx',
- u'warty-gnome, --none--',
+ 'cprov, celso.providelo@xxxxxxxxxxxxx',
+ 'edgar, edgar@xxxxxxxxxxxxxxxx',
+ 'jdub, jeff.waugh@xxxxxxxxxxxxxxx',
+ 'kamion, colin.watson@xxxxxxxxxxxxxxx',
+ 'kinnison, daniel.silverstone@xxxxxxxxxxxxx',
+ 'limi, limi@xxxxxxxxx',
+ 'name16, foo.bar@xxxxxxxxxxxxx',
+ 'mark, mark@xxxxxxxxxxx',
+ 'stevea, steve.alexander@xxxxxxxxxxxxxxx',
+ 'warty-gnome, --none--',
])
ubuntuteam_email = sorted([
- u'admin@xxxxxxxxxxxxx',
- u'celso.providelo@xxxxxxxxxxxxx',
- u'colin.watson@xxxxxxxxxxxxxxx',
- u'cprov@xxxxxxxxxx',
- u'daniel.silverstone@xxxxxxxxxxxxx',
- u'edgar@xxxxxxxxxxxxxxxx',
- u'foo.bar@xxxxxxxxxxxxx',
- u'jeff.waugh@xxxxxxxxxxxxxxx',
- u'limi@xxxxxxxxx',
- u'mark@xxxxxxxxxxx',
- u'steve.alexander@xxxxxxxxxxxxxxx',
+ 'admin@xxxxxxxxxxxxx',
+ 'celso.providelo@xxxxxxxxxxxxx',
+ 'colin.watson@xxxxxxxxxxxxxxx',
+ 'cprov@xxxxxxxxxx',
+ 'daniel.silverstone@xxxxxxxxxxxxx',
+ 'edgar@xxxxxxxxxxxxxxxx',
+ 'foo.bar@xxxxxxxxxxxxx',
+ 'jeff.waugh@xxxxxxxxxxxxxxx',
+ 'limi@xxxxxxxxx',
+ 'mark@xxxxxxxxxxx',
+ 'steve.alexander@xxxxxxxxxxxxxxx',
])
ubuntuteam_full = sorted([
- u'ubuntu-team|10|limi|limi@xxxxxxxxx|Alexander Limi|no',
- u'ubuntu-team|11|stevea|steve.alexander@xxxxxxxxxxxxxxx'
- u'|Steve Alexander|no',
- u'ubuntu-team|16|name16|foo.bar@xxxxxxxxxxxxx|Foo Bar|yes',
- u'ubuntu-team|19|warty-gnome|--none--|Warty Gnome Team|no',
- u'ubuntu-team|1|mark|mark@xxxxxxxxxxx|Mark Shuttleworth|no',
- u'ubuntu-team|26|kinnison|daniel.silverstone@xxxxxxxxxxxxx'
- u'|Daniel Silverstone|no',
- u'ubuntu-team|28|cprov|celso.providelo@xxxxxxxxxxxxx|Celso Providelo|no',
- u'ubuntu-team|33|edgar|edgar@xxxxxxxxxxxxxxxx|Edgar Bursic|no',
- u'ubuntu-team|4|kamion|colin.watson@xxxxxxxxxxxxxxx|Colin Watson|no',
- u'ubuntu-team|6|jdub|jeff.waugh@xxxxxxxxxxxxxxx|Jeff Waugh|no',
+ 'ubuntu-team|10|limi|limi@xxxxxxxxx|Alexander Limi|no',
+ 'ubuntu-team|11|stevea|steve.alexander@xxxxxxxxxxxxxxx'
+ '|Steve Alexander|no',
+ 'ubuntu-team|16|name16|foo.bar@xxxxxxxxxxxxx|Foo Bar|yes',
+ 'ubuntu-team|19|warty-gnome|--none--|Warty Gnome Team|no',
+ 'ubuntu-team|1|mark|mark@xxxxxxxxxxx|Mark Shuttleworth|no',
+ 'ubuntu-team|26|kinnison|daniel.silverstone@xxxxxxxxxxxxx'
+ '|Daniel Silverstone|no',
+ 'ubuntu-team|28|cprov|celso.providelo@xxxxxxxxxxxxx|Celso Providelo|no',
+ 'ubuntu-team|33|edgar|edgar@xxxxxxxxxxxxxxxx|Edgar Bursic|no',
+ 'ubuntu-team|4|kamion|colin.watson@xxxxxxxxxxxxxxx|Colin Watson|no',
+ 'ubuntu-team|6|jdub|jeff.waugh@xxxxxxxxxxxxxxx|Jeff Waugh|no',
])
ubuntuteam_sshkeys = [
- u'mark: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCeP6iOLFdRSJ/CwuUjj0dE3+bJi'
- u'ZUn2AsappUcjCZN75CBKvqPkpGDIU/ZlOddAdj1rif6dl9rqEBuoliduIZ1bmPaGs1jmpME'
- u'7HPctLhCmzy1oC8wkdVNkZnmoTW34j5Y8mKWuy32hVWvp3OdfIo+dxW576ny52VkTbST+t4'
- u'KlQ== Private key in lib/lp/codehosting/tests/id_rsa',
+ 'mark: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCeP6iOLFdRSJ/CwuUjj0dE3+bJi'
+ 'ZUn2AsappUcjCZN75CBKvqPkpGDIU/ZlOddAdj1rif6dl9rqEBuoliduIZ1bmPaGs1jmpME'
+ '7HPctLhCmzy1oC8wkdVNkZnmoTW34j5Y8mKWuy32hVWvp3OdfIo+dxW576ny52VkTbST+t4'
+ 'KlQ== Private key in lib/lp/codehosting/tests/id_rsa',
]
@@ -89,11 +89,11 @@ class ListTeamMembersTestCase(TestCaseWithFactory):
team = self.factory.makeTeam(name='squadron')
team.addMember(member, reviewer=team.teamowner)
sshkey = self.factory.makeSSHKey(member)
- sshkey.keytext = u'123badKeysMight\r\nContain\fBadCharacters'
+ sshkey.keytext = '123badKeysMight\r\nContain\fBadCharacters'
sshkey.comment = 'co\rmm\ne\f\fnt'
expected = dict(
- name=u'biggles',
- sshkey=u'ssh-rsa 123badKeysMightContainBadCharacters comment')
+ name='biggles',
+ sshkey='ssh-rsa 123badKeysMightContainBadCharacters comment')
result = listteammembers.make_sshkey_params(member, sshkey)
self.assertEqual(expected, result)
diff --git a/lib/lp/registry/tests/test_mailinglist.py b/lib/lp/registry/tests/test_mailinglist.py
index c57c57f..de70d1e 100644
--- a/lib/lp/registry/tests/test_mailinglist.py
+++ b/lib/lp/registry/tests/test_mailinglist.py
@@ -453,7 +453,7 @@ class MailingListSetTestCase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(MailingListSetTestCase, self).setUp()
+ super().setUp()
self.mailing_list_set = getUtility(IMailingListSet)
login_celebrity('admin')
@@ -717,7 +717,7 @@ class MailingListMessageTestCase(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(MailingListMessageTestCase, self).setUp()
+ super().setUp()
self.mailing_list_set = getUtility(IMailingListSet)
login_celebrity('admin')
diff --git a/lib/lp/registry/tests/test_mailinglistapi.py b/lib/lp/registry/tests/test_mailinglistapi.py
index c7ea028..c992116 100644
--- a/lib/lp/registry/tests/test_mailinglistapi.py
+++ b/lib/lp/registry/tests/test_mailinglistapi.py
@@ -63,7 +63,7 @@ class MailingListAPITestCase(TestCaseWithFactory):
def setUp(self):
"""Create a team with a list and subscribe self.member to it."""
- super(MailingListAPITestCase, self).setUp()
+ super().setUp()
self.team, self.mailing_list = new_team('team-a', with_list=True)
self.member = self.factory.makePersonByName('Bob')
with person_logged_in(self.member):
@@ -73,8 +73,8 @@ class MailingListAPITestCase(TestCaseWithFactory):
self.team_expected = sorted([
(config.mailman.archive_address, '', 0, ENABLED),
('bob.person@xxxxxxxxxxx', 'Bob Person', 0, ENABLED),
- ('bperson@xxxxxxxxxxx', u'Bob Person', 0, BYUSER),
- ('no-priv@xxxxxxxxxxxxx', u'No Privileges Person', 0, BYUSER),
+ ('bperson@xxxxxxxxxxx', 'Bob Person', 0, BYUSER),
+ ('no-priv@xxxxxxxxxxxxx', 'No Privileges Person', 0, BYUSER),
])
def test_getMembershipInformation(self):
@@ -256,7 +256,7 @@ class MailingListAPIWorkflowTestCase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(MailingListAPIWorkflowTestCase, self).setUp()
+ super().setUp()
self.mailinglist_api = MailingListAPIView(None, None)
self.mailinglist_set = getUtility(IMailingListSet)
@@ -274,8 +274,8 @@ class MailingListAPIWorkflowTestCase(TestCaseWithFactory):
self.mailinglist_set.new(team_b, team_b.teamowner)
self.assertEqual(
{'create': [
- (u'team-a', {}),
- (u'team-b', {})]},
+ ('team-a', {}),
+ ('team-b', {})]},
self.mailinglist_api.getPendingActions())
def test_getPendingActions_constructing(self):
@@ -284,7 +284,7 @@ class MailingListAPIWorkflowTestCase(TestCaseWithFactory):
team_list = self.mailinglist_set.new(team, team.teamowner)
self.assertEqual(MailingListStatus.APPROVED, team_list.status)
actions = self.mailinglist_api.getPendingActions()
- self.assertEqual({'create': [(u'team', {})]}, actions)
+ self.assertEqual({'create': [('team', {})]}, actions)
self.assertEqual(MailingListStatus.CONSTRUCTING, team_list.status)
def test_reportStatus_constructing_success(self):
@@ -311,7 +311,7 @@ class MailingListAPIWorkflowTestCase(TestCaseWithFactory):
actions = self.mailinglist_api.getPendingActions()
actions = self.mailinglist_api.getPendingActions()
self.assertEqual(
- {'unsynchronized': [(u'team', 'constructing')]}, actions)
+ {'unsynchronized': [('team', 'constructing')]}, actions)
self.assertEqual(MailingListStatus.CONSTRUCTING, team_list.status)
def test_getPendingActions_deactivating(self):
@@ -322,7 +322,7 @@ class MailingListAPIWorkflowTestCase(TestCaseWithFactory):
team_list.deactivate()
self.assertEqual(MailingListStatus.DEACTIVATING, team_list.status)
actions = self.mailinglist_api.getPendingActions()
- self.assertEqual({'deactivate': [u'team']}, actions)
+ self.assertEqual({'deactivate': ['team']}, actions)
self.assertEqual(MailingListStatus.DEACTIVATING, team_list.status)
def test_reportStatus_deactivating_success(self):
@@ -354,7 +354,7 @@ class MailingListAPIWorkflowTestCase(TestCaseWithFactory):
self.assertEqual(MailingListStatus.MODIFIED, team_list.status)
actions = self.mailinglist_api.getPendingActions()
self.assertEqual(
- {'modify': [(u'team', {'welcome_message': u'hi'})]}, actions)
+ {'modify': [('team', {'welcome_message': 'hi'})]}, actions)
self.assertEqual(MailingListStatus.UPDATING, team_list.status)
def test_reportStatus_modifying_success(self):
@@ -426,7 +426,7 @@ class MailingListAPIMessageTestCase(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(MailingListAPIMessageTestCase, self).setUp()
+ super().setUp()
self.mailinglist_api = MailingListAPIView(None, None)
self.mailinglist_set = getUtility(IMailingListSet)
self.message_set = getUtility(IMessageSet)
@@ -526,7 +526,7 @@ class MailingListAPIMessageTestCase(TestCaseWithFactory):
found.approve(team.teamowner)
self.assertEqual(PostedMessageStatus.APPROVAL_PENDING, found.status)
self.assertEqual(
- {u'<first-post>': (u'team', 'accept')},
+ {'<first-post>': ('team', 'accept')},
self.mailinglist_api.getMessageDispositions())
self.assertEqual(PostedMessageStatus.APPROVED, found.status)
@@ -539,7 +539,7 @@ class MailingListAPIMessageTestCase(TestCaseWithFactory):
found.reject(team.teamowner)
self.assertEqual(PostedMessageStatus.REJECTION_PENDING, found.status)
self.assertEqual(
- {u'<first-post>': (u'team', 'decline')},
+ {'<first-post>': ('team', 'decline')},
self.mailinglist_api.getMessageDispositions())
self.assertEqual(PostedMessageStatus.REJECTED, found.status)
@@ -552,6 +552,6 @@ class MailingListAPIMessageTestCase(TestCaseWithFactory):
found.discard(team.teamowner)
self.assertEqual(PostedMessageStatus.DISCARD_PENDING, found.status)
self.assertEqual(
- {u'<first-post>': (u'team', 'discard')},
+ {'<first-post>': ('team', 'discard')},
self.mailinglist_api.getMessageDispositions())
self.assertEqual(PostedMessageStatus.DISCARDED, found.status)
diff --git a/lib/lp/registry/tests/test_membership_notification_job.py b/lib/lp/registry/tests/test_membership_notification_job.py
index 3d4ca21..c7337cd 100644
--- a/lib/lp/registry/tests/test_membership_notification_job.py
+++ b/lib/lp/registry/tests/test_membership_notification_job.py
@@ -40,7 +40,7 @@ class MembershipNotificationJobTest(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(MembershipNotificationJobTest, self).setUp()
+ super().setUp()
self.person = self.factory.makePerson(name='murdock')
self.team = self.factory.makeTeam(name='a-team')
self.job_source = getUtility(IMembershipNotificationJobSource)
diff --git a/lib/lp/registry/tests/test_milestone.py b/lib/lp/registry/tests/test_milestone.py
index f20894c..884e826 100644
--- a/lib/lp/registry/tests/test_milestone.py
+++ b/lib/lp/registry/tests/test_milestone.py
@@ -118,7 +118,7 @@ class MilestoneSecurityAdaperTestCase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(MilestoneSecurityAdaperTestCase, self).setUp()
+ super().setUp()
self.public_product = self.factory.makeProduct()
self.public_milestone = self.factory.makeMilestone(
product=self.public_product)
@@ -453,7 +453,7 @@ class MilestoneBugTaskSpecificationTest(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(MilestoneBugTaskSpecificationTest, self).setUp()
+ super().setUp()
self.owner = self.factory.makePerson()
self.product = self.factory.makeProduct(name="product1")
self.milestone = self.factory.makeMilestone(product=self.product)
@@ -618,7 +618,7 @@ class ProjectMilestoneSecurityAdaperTestCase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(ProjectMilestoneSecurityAdaperTestCase, self).setUp()
+ super().setUp()
project_group = self.factory.makeProject()
public_product = self.factory.makeProduct(projectgroup=project_group)
self.factory.makeMilestone(
diff --git a/lib/lp/registry/tests/test_milestone_vocabularies.py b/lib/lp/registry/tests/test_milestone_vocabularies.py
index 0cae9eb..e8f4ad9 100644
--- a/lib/lp/registry/tests/test_milestone_vocabularies.py
+++ b/lib/lp/registry/tests/test_milestone_vocabularies.py
@@ -55,7 +55,7 @@ class TestMilestoneVocabulary(TestCaseWithFactory):
firefox = getUtility(IProductSet).getByName('firefox')
vocabulary = MilestoneVocabulary(firefox)
self.assertEqual(
- [term.title for term in vocabulary], [u'Mozilla Firefox 1.0'])
+ [term.title for term in vocabulary], ['Mozilla Firefox 1.0'])
def testProductSeriesMilestoneVocabulary(self):
"""Test of MilestoneVocabulary for a product series."""
@@ -63,14 +63,14 @@ class TestMilestoneVocabulary(TestCaseWithFactory):
trunk = firefox.getSeries('trunk')
vocabulary = MilestoneVocabulary(trunk)
self.assertEqual(
- [term.title for term in vocabulary], [u'Mozilla Firefox 1.0'])
+ [term.title for term in vocabulary], ['Mozilla Firefox 1.0'])
def testProjectGroupMilestoneVocabulary(self):
"""Test of MilestoneVocabulary for a project group."""
mozilla = getUtility(IProjectGroupSet).getByName('mozilla')
vocabulary = MilestoneVocabulary(mozilla)
self.assertEqual(
- [term.title for term in vocabulary], [u'Mozilla Firefox 1.0'])
+ [term.title for term in vocabulary], ['Mozilla Firefox 1.0'])
def testDistributionMilestoneVocabulary(self):
"""Test of MilestoneVocabulary for a distribution."""
@@ -78,7 +78,7 @@ class TestMilestoneVocabulary(TestCaseWithFactory):
vocabulary = MilestoneVocabulary(debian)
self.assertEqual(
[term.title for term in vocabulary],
- [u'Debian 3.1', u'Debian 3.1-rc1'])
+ ['Debian 3.1', 'Debian 3.1-rc1'])
def testDistroseriesMilestoneVocabulary(self):
"""Test of MilestoneVocabulary for a distroseries."""
@@ -87,7 +87,7 @@ class TestMilestoneVocabulary(TestCaseWithFactory):
vocabulary = MilestoneVocabulary(woody)
self.assertEqual(
[term.title for term in vocabulary],
- [u'Debian 3.1', u'Debian 3.1-rc1'])
+ ['Debian 3.1', 'Debian 3.1-rc1'])
def testSpecificationMilestoneVocabulary(self):
"""Test of MilestoneVocabulary for a specification."""
@@ -96,7 +96,7 @@ class TestMilestoneVocabulary(TestCaseWithFactory):
self.assertEqual(spec.target, firefox)
vocabulary = MilestoneVocabulary(spec)
self.assertEqual(
- [term.title for term in vocabulary], [u'Mozilla Firefox 1.0'])
+ [term.title for term in vocabulary], ['Mozilla Firefox 1.0'])
def testPersonMilestoneVocabulary(self):
"""Test of MilestoneVocabulary for a person."""
@@ -107,7 +107,7 @@ class TestMilestoneVocabulary(TestCaseWithFactory):
# in such a case of all known visible milestones.
self.assertEqual(
[term.title for term in vocabulary],
- [u'Debian 3.1', u'Debian 3.1-rc1', u'Mozilla Firefox 1.0'])
+ ['Debian 3.1', 'Debian 3.1-rc1', 'Mozilla Firefox 1.0'])
class TestMilestoneWithDateExpectedVocabulary(TestCaseWithFactory):
@@ -119,7 +119,7 @@ class TestMilestoneWithDateExpectedVocabulary(TestCaseWithFactory):
vocabulary = MilestoneWithDateExpectedVocabulary(firefox)
self.assertEqual(
[term.title for term in vocabulary],
- [u'Mozilla Firefox 1.0 (2056-10-16)'])
+ ['Mozilla Firefox 1.0 (2056-10-16)'])
def test_milestone_without_date_expected(self):
evolution = getUtility(IProductSet).getByName('evolution')
diff --git a/lib/lp/registry/tests/test_milestonetag.py b/lib/lp/registry/tests/test_milestonetag.py
index 0713fe4..10ff914 100644
--- a/lib/lp/registry/tests/test_milestonetag.py
+++ b/lib/lp/registry/tests/test_milestonetag.py
@@ -29,10 +29,10 @@ class MilestoneTagTest(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(MilestoneTagTest, self).setUp()
+ super().setUp()
self.milestone = self.factory.makeMilestone()
self.person = self.milestone.target.owner
- self.tags = [u'tag2', u'tag1', u'tag3']
+ self.tags = ['tag2', 'tag1', 'tag3']
def test_no_tags(self):
# Ensure a newly created milestone does not have associated tags.
@@ -48,7 +48,7 @@ class MilestoneTagTest(TestCaseWithFactory):
# Ensure you can override tags already associated with the milestone.
with person_logged_in(self.person):
self.milestone.setTags(self.tags, self.person)
- new_tags = [u'tag2', u'tag4', u'tag3']
+ new_tags = ['tag2', 'tag4', 'tag3']
self.milestone.setTags(new_tags, self.person)
self.assertEqual(sorted(new_tags), self.milestone.getTags())
@@ -61,7 +61,7 @@ class MilestoneTagTest(TestCaseWithFactory):
def test_user_metadata(self):
# Ensure the correct user metadata is created when tags are added.
- tag = u'tag1'
+ tag = 'tag1'
with person_logged_in(self.person):
self.milestone.setTags([tag], self.person)
values = self.milestone.getTagsData().values(
@@ -78,7 +78,7 @@ class MilestoneTagTest(TestCaseWithFactory):
new_person = self.factory.makePerson()
with person_logged_in(self.person):
self.milestone.setTags(self.tags, self.person)
- new_tags = [u'tag2', u'tag4', u'tag3']
+ new_tags = ['tag2', 'tag4', 'tag3']
self.milestone.setTags(new_tags, new_person)
values = self.milestone.getTagsData().values(
MilestoneTag.tag,
@@ -99,7 +99,7 @@ class ProjectGroupMilestoneTagTest(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(ProjectGroupMilestoneTagTest, self).setUp()
+ super().setUp()
self.owner = self.factory.makePerson()
self.project_group = self.factory.makeProject(owner=self.owner)
self.product = self.factory.makeProduct(
@@ -131,7 +131,7 @@ class ProjectGroupMilestoneTagTest(TestCaseWithFactory):
specifications.append(specification)
return specifications
- def _create_items_for_retrieval(self, factory, tag=u'tag1'):
+ def _create_items_for_retrieval(self, factory, tag='tag1'):
with person_logged_in(self.owner):
self.milestone.setTags([tag], self.owner)
items = factory(5, self.milestone)
@@ -139,7 +139,7 @@ class ProjectGroupMilestoneTagTest(TestCaseWithFactory):
target=self.project_group, tags=[tag])
return items, milestonetag
- def _create_items_for_untagged_milestone(self, factory, tag=u'tag1'):
+ def _create_items_for_untagged_milestone(self, factory, tag='tag1'):
new_milestone = self.factory.makeMilestone(product=self.product)
with person_logged_in(self.owner):
self.milestone.setTags([tag], self.owner)
@@ -150,7 +150,7 @@ class ProjectGroupMilestoneTagTest(TestCaseWithFactory):
return items, milestonetag
def _create_items_for_multiple_tags(
- self, factory, tags=(u'tag1', u'tag2')):
+ self, factory, tags=('tag1', 'tag2')):
new_milestone = self.factory.makeMilestone(product=self.product)
with person_logged_in(self.owner):
self.milestone.setTags(tags, self.owner)
@@ -211,7 +211,7 @@ class MilestoneTagWebServiceTest(WebServiceTestCase):
layer = AppServerLayer
def setUp(self):
- super(MilestoneTagWebServiceTest, self).setUp()
+ super().setUp()
self.owner = self.factory.makePerson()
self.product = self.factory.makeProduct(owner=self.owner)
self.milestone = self.factory.makeMilestone(product=self.product)
@@ -222,22 +222,22 @@ class MilestoneTagWebServiceTest(WebServiceTestCase):
self.assertEqual([], self.ws_milestone.getTags())
def test_get_tags(self):
- tags = [u'zeta', u'alpha', u'beta']
+ tags = ['zeta', 'alpha', 'beta']
self.milestone.setTags(tags, self.owner)
transaction.commit()
self.assertEqual(sorted(tags), self.ws_milestone.getTags())
def test_set_tags_initial(self):
- tags = [u'zeta', u'alpha', u'beta']
+ tags = ['zeta', 'alpha', 'beta']
self.ws_milestone.setTags(tags=tags)
self.ws_milestone.lp_save()
transaction.begin()
self.assertEqual(sorted(tags), self.milestone.getTags())
def test_set_tags_replace(self):
- tags1 = [u'zeta', u'alpha', u'beta']
+ tags1 = ['zeta', 'alpha', 'beta']
self.milestone.setTags(tags1, self.owner)
- tags2 = [u'delta', u'alpha', u'gamma']
+ tags2 = ['delta', 'alpha', 'gamma']
self.ws_milestone.setTags(tags=tags2)
self.ws_milestone.lp_save()
transaction.begin()
@@ -245,4 +245,4 @@ class MilestoneTagWebServiceTest(WebServiceTestCase):
def test_set_tags_invalid(self):
self.assertRaises(
- BadRequest, self.ws_milestone.setTags, tags=[u'&%&%^&'])
+ BadRequest, self.ws_milestone.setTags, tags=['&%&%^&'])
diff --git a/lib/lp/registry/tests/test_mlists.py b/lib/lp/registry/tests/test_mlists.py
index eedcfa2..ac751d5 100644
--- a/lib/lp/registry/tests/test_mlists.py
+++ b/lib/lp/registry/tests/test_mlists.py
@@ -88,7 +88,7 @@ class BaseMailingListImportTest(unittest.TestCase):
members = {person.name for person in self.team.allmembers}
expected = set(people)
# Always add the team owner.
- expected.add(u'teamowner')
+ expected.add('teamowner')
self.assertEqual(members, expected)
def assertAddresses(self, *addresses):
@@ -117,11 +117,11 @@ class TestMailingListImports(BaseMailingListImportTest):
'dperson@xxxxxxxxxxx',
'elly.person@xxxxxxxxxxx',
))
- self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly')
+ self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly')
self.assertAddresses(
- u'anne.person@xxxxxxxxxxx', u'bperson@xxxxxxxxxxx',
- u'cris.person@xxxxxxxxxxx', u'dperson@xxxxxxxxxxx',
- u'elly.person@xxxxxxxxxxx')
+ 'anne.person@xxxxxxxxxxx', 'bperson@xxxxxxxxxxx',
+ 'cris.person@xxxxxxxxxxx', 'dperson@xxxxxxxxxxx',
+ 'elly.person@xxxxxxxxxxx')
def test_extended_import_membership(self):
# Test the import of a list/team membership, where all email
@@ -134,11 +134,11 @@ class TestMailingListImports(BaseMailingListImportTest):
'dperson@xxxxxxxxxxx',
'elly.person@xxxxxxxxxxx (Elly Q. Person)',
))
- self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly')
+ self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly')
self.assertAddresses(
- u'anne.person@xxxxxxxxxxx', u'bperson@xxxxxxxxxxx',
- u'cris.person@xxxxxxxxxxx', u'dperson@xxxxxxxxxxx',
- u'elly.person@xxxxxxxxxxx')
+ 'anne.person@xxxxxxxxxxx', 'bperson@xxxxxxxxxxx',
+ 'cris.person@xxxxxxxxxxx', 'dperson@xxxxxxxxxxx',
+ 'elly.person@xxxxxxxxxxx')
def test_import_with_non_persons(self):
# Test the import of a list/team membership where not all the
@@ -155,11 +155,11 @@ class TestMailingListImports(BaseMailingListImportTest):
'gwen.person@xxxxxxxxxxx',
'hperson@xxxxxxxxxxx',
))
- self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly')
+ self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly')
self.assertAddresses(
- u'anne.person@xxxxxxxxxxx', u'bperson@xxxxxxxxxxx',
- u'cris.person@xxxxxxxxxxx', u'dperson@xxxxxxxxxxx',
- u'elly.person@xxxxxxxxxxx')
+ 'anne.person@xxxxxxxxxxx', 'bperson@xxxxxxxxxxx',
+ 'cris.person@xxxxxxxxxxx', 'dperson@xxxxxxxxxxx',
+ 'elly.person@xxxxxxxxxxx')
def test_import_with_invalid_emails(self):
# Test the import of a list/team membership where all the
@@ -177,10 +177,10 @@ class TestMailingListImports(BaseMailingListImportTest):
'dperson@xxxxxxxxxxx',
'elly.person@xxxxxxxxxxx',
))
- self.assertPeople(u'bart', u'cris', u'dave', u'elly')
+ self.assertPeople('bart', 'cris', 'dave', 'elly')
self.assertAddresses(
- u'bperson@xxxxxxxxxxx', u'cris.person@xxxxxxxxxxx',
- u'dperson@xxxxxxxxxxx', u'elly.person@xxxxxxxxxxx')
+ 'bperson@xxxxxxxxxxx', 'cris.person@xxxxxxxxxxx',
+ 'dperson@xxxxxxxxxxx', 'elly.person@xxxxxxxxxxx')
def test_already_joined(self):
# Test import when a user is already joined to the team, but
@@ -194,11 +194,11 @@ class TestMailingListImports(BaseMailingListImportTest):
'dperson@xxxxxxxxxxx',
'elly.person@xxxxxxxxxxx',
))
- self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly')
+ self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly')
self.assertAddresses(
- u'anne.person@xxxxxxxxxxx', u'bperson@xxxxxxxxxxx',
- u'cris.person@xxxxxxxxxxx', u'dperson@xxxxxxxxxxx',
- u'elly.person@xxxxxxxxxxx')
+ 'anne.person@xxxxxxxxxxx', 'bperson@xxxxxxxxxxx',
+ 'cris.person@xxxxxxxxxxx', 'dperson@xxxxxxxxxxx',
+ 'elly.person@xxxxxxxxxxx')
def test_already_subscribed(self):
# Test import when a user is already joined to the team, and
@@ -213,11 +213,11 @@ class TestMailingListImports(BaseMailingListImportTest):
'dperson@xxxxxxxxxxx',
'elly.person@xxxxxxxxxxx',
))
- self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly')
+ self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly')
self.assertAddresses(
- u'anne.person@xxxxxxxxxxx', u'bperson@xxxxxxxxxxx',
- u'cris.person@xxxxxxxxxxx', u'dperson@xxxxxxxxxxx',
- u'elly.person@xxxxxxxxxxx')
+ 'anne.person@xxxxxxxxxxx', 'bperson@xxxxxxxxxxx',
+ 'cris.person@xxxxxxxxxxx', 'dperson@xxxxxxxxxxx',
+ 'elly.person@xxxxxxxxxxx')
def test_import_from_file(self):
# Test importing addresses from a file.
@@ -230,11 +230,11 @@ class TestMailingListImports(BaseMailingListImportTest):
'Elly Q. Person <eperson@xxxxxxxxxxx',
)
importer.importFromFile(self.filename)
- self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly')
+ self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly')
self.assertAddresses(
- u'anne.person@xxxxxxxxxxx', u'bart.person@xxxxxxxxxxx',
- u'cperson@xxxxxxxxxxx', u'dperson@xxxxxxxxxxx',
- u'eperson@xxxxxxxxxxx')
+ 'anne.person@xxxxxxxxxxx', 'bart.person@xxxxxxxxxxx',
+ 'cperson@xxxxxxxxxxx', 'dperson@xxxxxxxxxxx',
+ 'eperson@xxxxxxxxxxx')
def test_import_from_file_with_non_persons(self):
# Test the import of a list/team membership from a file where
@@ -254,11 +254,11 @@ class TestMailingListImports(BaseMailingListImportTest):
'iris.person@xxxxxxxxxxx',
)
importer.importFromFile(self.filename)
- self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly')
+ self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly')
self.assertAddresses(
- u'anne.person@xxxxxxxxxxx', u'bart.person@xxxxxxxxxxx',
- u'cperson@xxxxxxxxxxx', u'dperson@xxxxxxxxxxx',
- u'eperson@xxxxxxxxxxx')
+ 'anne.person@xxxxxxxxxxx', 'bart.person@xxxxxxxxxxx',
+ 'cperson@xxxxxxxxxxx', 'dperson@xxxxxxxxxxx',
+ 'eperson@xxxxxxxxxxx')
def test_import_from_file_with_invalid_emails(self):
# Test importing addresses from a file with invalid emails.
@@ -274,10 +274,10 @@ class TestMailingListImports(BaseMailingListImportTest):
'Elly Q. Person <eperson@xxxxxxxxxxx',
)
importer.importFromFile(self.filename)
- self.assertPeople(u'bart', u'cris', u'dave', u'elly')
+ self.assertPeople('bart', 'cris', 'dave', 'elly')
self.assertAddresses(
- u'bart.person@xxxxxxxxxxx', u'cperson@xxxxxxxxxxx',
- u'dperson@xxxxxxxxxxx', u'eperson@xxxxxxxxxxx')
+ 'bart.person@xxxxxxxxxxx', 'cperson@xxxxxxxxxxx',
+ 'dperson@xxxxxxxxxxx', 'eperson@xxxxxxxxxxx')
def test_logging(self):
# Test that nothing gets logged when all imports are fine.
@@ -381,7 +381,7 @@ class TestMailingListImportScript(BaseMailingListImportTest):
layer = AppServerLayer
def setUp(self):
- super(TestMailingListImportScript, self).setUp()
+ super().setUp()
# Since these tests involve two processes, the setup transaction must
# be committed, otherwise the script won't see the changes.
transaction.commit()
@@ -418,11 +418,11 @@ class TestMailingListImportScript(BaseMailingListImportTest):
self.assertEqual(process.returncode, 0, stdout)
# Make sure we hit the database.
transaction.abort()
- self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly')
+ self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly')
self.assertAddresses(
- u'anne.person@xxxxxxxxxxx', u'bart.person@xxxxxxxxxxx',
- u'cperson@xxxxxxxxxxx', u'dperson@xxxxxxxxxxx',
- u'eperson@xxxxxxxxxxx')
+ 'anne.person@xxxxxxxxxxx', 'bart.person@xxxxxxxxxxx',
+ 'cperson@xxxxxxxxxxx', 'dperson@xxxxxxxxxxx',
+ 'eperson@xxxxxxxxxxx')
def test_notification_suppression(self):
# Test that importing some addresses produces no notifications, which
@@ -508,8 +508,8 @@ class TestImportToRestrictedList(BaseMailingListImportTest):
'dperson@xxxxxxxxxxx',
'elly.person@xxxxxxxxxxx',
))
- self.assertPeople(u'anne', u'bart', u'cris', u'dave', u'elly')
+ self.assertPeople('anne', 'bart', 'cris', 'dave', 'elly')
self.assertAddresses(
- u'anne.person@xxxxxxxxxxx', u'bperson@xxxxxxxxxxx',
- u'cris.person@xxxxxxxxxxx', u'dperson@xxxxxxxxxxx',
- u'elly.person@xxxxxxxxxxx')
+ 'anne.person@xxxxxxxxxxx', 'bperson@xxxxxxxxxxx',
+ 'cris.person@xxxxxxxxxxx', 'dperson@xxxxxxxxxxx',
+ 'elly.person@xxxxxxxxxxx')
diff --git a/lib/lp/registry/tests/test_nameblacklist.py b/lib/lp/registry/tests/test_nameblacklist.py
index f533b93..30314ca 100644
--- a/lib/lp/registry/tests/test_nameblacklist.py
+++ b/lib/lp/registry/tests/test_nameblacklist.py
@@ -29,13 +29,13 @@ class TestNameBlacklist(TestCaseWithFactory):
layer = ZopelessDatabaseLayer
def setUp(self):
- super(TestNameBlacklist, self).setUp()
+ super().setUp()
self.name_blacklist_set = getUtility(INameBlacklistSet)
- self.caret_foo_exp = self.name_blacklist_set.create(u'^foo')
- self.foo_exp = self.name_blacklist_set.create(u'foo')
- self.verbose_exp = self.name_blacklist_set.create(u'v e r b o s e')
+ self.caret_foo_exp = self.name_blacklist_set.create('^foo')
+ self.foo_exp = self.name_blacklist_set.create('foo')
+ self.verbose_exp = self.name_blacklist_set.create('v e r b o s e')
team = self.factory.makeTeam()
- self.admin_exp = self.name_blacklist_set.create(u'fnord', admin=team)
+ self.admin_exp = self.name_blacklist_set.create('fnord', admin=team)
self.store = IStore(self.foo_exp)
self.store.flush()
@@ -59,16 +59,16 @@ class TestNameBlacklist(TestCaseWithFactory):
def test_name_blacklist_match(self):
# A name that is not blacklisted returns NULL/None
- self.assertIsNone(self.name_blacklist_match(u"bar"))
+ self.assertIsNone(self.name_blacklist_match("bar"))
# A name that is blacklisted returns the id of the row in the
# NameBlacklist table that matched. Rows are tried in order, and the
# first match is returned.
self.assertEqual(
- self.name_blacklist_match(u"foobar"),
+ self.name_blacklist_match("foobar"),
self.caret_foo_exp.id)
self.assertEqual(
- self.name_blacklist_match(u"barfoo"),
+ self.name_blacklist_match("barfoo"),
self.foo_exp.id)
def test_name_blacklist_match_admin_does_not_match(self):
@@ -76,7 +76,7 @@ class TestNameBlacklist(TestCaseWithFactory):
# backlisted name restriction.
user = self.admin_exp.admin.teamowner
self.assertEqual(
- None, self.name_blacklist_match(u"fnord", user.id))
+ None, self.name_blacklist_match("fnord", user.id))
def test_name_blacklist_match_launchpad_admin_can_change(self):
# A Launchpad admin is exempt from any backlisted name restriction
@@ -85,7 +85,7 @@ class TestNameBlacklist(TestCaseWithFactory):
admins = getUtility(ILaunchpadCelebrities).admin
admins.addMember(user, user)
self.assertEqual(
- None, self.name_blacklist_match(u"fnord", user.id))
+ None, self.name_blacklist_match("fnord", user.id))
def test_name_blacklist_match_launchpad_admin_cannot_change(self):
# A Launchpad admin cannot override backlisted names without admins.
@@ -93,42 +93,42 @@ class TestNameBlacklist(TestCaseWithFactory):
admins = getUtility(ILaunchpadCelebrities).admin
admins.addMember(user, user)
self.assertEqual(
- self.foo_exp.id, self.name_blacklist_match(u"barfoo", user.id))
+ self.foo_exp.id, self.name_blacklist_match("barfoo", user.id))
def test_name_blacklist_match_cache(self):
# If the blacklist is changed in the DB, these changes are noticed.
# This test is needed because the stored procedure keeps a cache
# of the compiled regular expressions.
self.assertEqual(
- self.name_blacklist_match(u"foobar"),
+ self.name_blacklist_match("foobar"),
self.caret_foo_exp.id)
- self.caret_foo_exp.regexp = u'nomatch'
+ self.caret_foo_exp.regexp = 'nomatch'
self.assertEqual(
- self.name_blacklist_match(u"foobar"),
+ self.name_blacklist_match("foobar"),
self.foo_exp.id)
- self.foo_exp.regexp = u'nomatch2'
- self.assertIsNone(self.name_blacklist_match(u"foobar"))
+ self.foo_exp.regexp = 'nomatch2'
+ self.assertIsNone(self.name_blacklist_match("foobar"))
def test_is_blacklisted_name(self):
# is_blacklisted_name() is just a wrapper around name_blacklist_match
# that is friendlier to use in a boolean context.
- self.assertFalse(self.is_blacklisted_name(u"bar"))
- self.assertTrue(self.is_blacklisted_name(u"foo"))
- self.caret_foo_exp.regexp = u'bar'
- self.foo_exp.regexp = u'bar2'
- self.assertFalse(self.is_blacklisted_name(u"foo"))
+ self.assertFalse(self.is_blacklisted_name("bar"))
+ self.assertTrue(self.is_blacklisted_name("foo"))
+ self.caret_foo_exp.regexp = 'bar'
+ self.foo_exp.regexp = 'bar2'
+ self.assertFalse(self.is_blacklisted_name("foo"))
def test_is_blacklisted_name_admin_false(self):
# Users in the expression's admin team are will return False.
user = self.admin_exp.admin.teamowner
- self.assertFalse(self.is_blacklisted_name(u"fnord", user.id))
+ self.assertFalse(self.is_blacklisted_name("fnord", user.id))
def test_case_insensitive(self):
- self.assertTrue(self.is_blacklisted_name(u"Foo"))
+ self.assertTrue(self.is_blacklisted_name("Foo"))
def test_verbose(self):
# Testing the VERBOSE flag is used when compiling the regexp
- self.assertTrue(self.is_blacklisted_name(u"verbose"))
+ self.assertTrue(self.is_blacklisted_name("verbose"))
class TestNameBlacklistSet(TestCaseWithFactory):
@@ -136,36 +136,36 @@ class TestNameBlacklistSet(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestNameBlacklistSet, self).setUp()
+ super().setUp()
login_celebrity('registry_experts')
self.name_blacklist_set = getUtility(INameBlacklistSet)
def test_create_with_one_arg(self):
# Test NameBlacklistSet.create(regexp).
- name_blacklist = self.name_blacklist_set.create(u'foo')
+ name_blacklist = self.name_blacklist_set.create('foo')
self.assertTrue(verifyObject(INameBlacklist, name_blacklist))
- self.assertEqual(u'foo', name_blacklist.regexp)
+ self.assertEqual('foo', name_blacklist.regexp)
self.assertIs(None, name_blacklist.comment)
def test_create_with_two_args(self):
# Test NameBlacklistSet.create(regexp, comment).
- name_blacklist = self.name_blacklist_set.create(u'foo', u'bar')
+ name_blacklist = self.name_blacklist_set.create('foo', 'bar')
self.assertTrue(verifyObject(INameBlacklist, name_blacklist))
- self.assertEqual(u'foo', name_blacklist.regexp)
- self.assertEqual(u'bar', name_blacklist.comment)
+ self.assertEqual('foo', name_blacklist.regexp)
+ self.assertEqual('bar', name_blacklist.comment)
def test_create_with_three_args(self):
# Test NameBlacklistSet.create(regexp, comment, admin).
team = self.factory.makeTeam()
- name_blacklist = self.name_blacklist_set.create(u'foo', u'bar', team)
+ name_blacklist = self.name_blacklist_set.create('foo', 'bar', team)
self.assertTrue(verifyObject(INameBlacklist, name_blacklist))
- self.assertEqual(u'foo', name_blacklist.regexp)
- self.assertEqual(u'bar', name_blacklist.comment)
+ self.assertEqual('foo', name_blacklist.regexp)
+ self.assertEqual('bar', name_blacklist.comment)
self.assertEqual(team, name_blacklist.admin)
def test_get_int(self):
# Test NameBlacklistSet.get() with int id.
- name_blacklist = self.name_blacklist_set.create(u'foo', u'bar')
+ name_blacklist = self.name_blacklist_set.create('foo', 'bar')
store = IStore(name_blacklist)
store.flush()
retrieved = self.name_blacklist_set.get(name_blacklist.id)
@@ -173,7 +173,7 @@ class TestNameBlacklistSet(TestCaseWithFactory):
def test_get_string(self):
# Test NameBlacklistSet.get() with string id.
- name_blacklist = self.name_blacklist_set.create(u'foo', u'bar')
+ name_blacklist = self.name_blacklist_set.create('foo', 'bar')
store = IStore(name_blacklist)
store.flush()
retrieved = self.name_blacklist_set.get(str(name_blacklist.id))
@@ -213,7 +213,7 @@ class TestNameBlacklistSet(TestCaseWithFactory):
def test_NameBlacklist_permissions(self):
# Verify that non-registry-experts do not have permission to
# access the NameBlacklist.
- name_blacklist = self.name_blacklist_set.create(u'foo')
+ name_blacklist = self.name_blacklist_set.create('foo')
self.assertTrue(check_permission('launchpad.View', name_blacklist))
self.assertTrue(check_permission('launchpad.Edit', name_blacklist))
login(ANONYMOUS)
diff --git a/lib/lp/registry/tests/test_notification.py b/lib/lp/registry/tests/test_notification.py
index ead0170..5d1a6a6 100644
--- a/lib/lp/registry/tests/test_notification.py
+++ b/lib/lp/registry/tests/test_notification.py
@@ -100,9 +100,9 @@ class SendDirectContactEmailTestCase(TestCaseWithFactory):
def test_name_utf8_encoding(self):
# Names are encoded in the From and To headers.
- self.factory.makePerson(email='me@xxxxxx', displayname=u'sn\xefrf')
+ self.factory.makePerson(email='me@xxxxxx', displayname='sn\xefrf')
user = self.factory.makePerson(
- email='him@xxxxxx', displayname=u'pti\xedng')
+ email='him@xxxxxx', displayname='pti\xedng')
recipients_set = NotificationRecipientSet()
recipients_set.add(user, 'test reason', 'test rationale')
pop_notifications()
diff --git a/lib/lp/registry/tests/test_ociproject.py b/lib/lp/registry/tests/test_ociproject.py
index 03036fb..14ec569 100644
--- a/lib/lp/registry/tests/test_ociproject.py
+++ b/lib/lp/registry/tests/test_ociproject.py
@@ -5,7 +5,6 @@
import json
-from six import text_type
from testtools.matchers import (
ContainsDict,
Equals,
@@ -230,7 +229,7 @@ class TestOCIProjectWebservice(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestOCIProjectWebservice, self).setUp()
+ super().setUp()
self.person = self.factory.makePerson(displayname="Test Person")
self.other_person = self.factory.makePerson()
self.webservice = webservice_for_person(
@@ -244,7 +243,7 @@ class TestOCIProjectWebservice(TestCaseWithFactory):
def getAbsoluteURL(self, target):
"""Get the webservice absolute URL of the given object or relative
path."""
- if not isinstance(target, text_type):
+ if not isinstance(target, str):
target = api_url(target)
return self.webservice.getAbsoluteUrl(target)
diff --git a/lib/lp/registry/tests/test_ociprojectseries.py b/lib/lp/registry/tests/test_ociprojectseries.py
index a938a54..771e9ce 100644
--- a/lib/lp/registry/tests/test_ociprojectseries.py
+++ b/lib/lp/registry/tests/test_ociprojectseries.py
@@ -3,7 +3,6 @@
"""Test OCIProjectSeries."""
-from six import string_types
from testtools.matchers import (
ContainsDict,
Equals,
@@ -108,7 +107,7 @@ class TestOCIProjectSeriesWebservice(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestOCIProjectSeriesWebservice, self).setUp()
+ super().setUp()
self.person = self.factory.makePerson(displayname="Test Person")
self.webservice = webservice_for_person(
self.person, permission=OAuthPermission.WRITE_PUBLIC,
@@ -117,7 +116,7 @@ class TestOCIProjectSeriesWebservice(TestCaseWithFactory):
def getAbsoluteURL(self, target):
"""Get the webservice absolute URL of the given object or relative
path."""
- if not isinstance(target, string_types):
+ if not isinstance(target, str):
target = api_url(target)
return self.webservice.getAbsoluteUrl(target)
diff --git a/lib/lp/registry/tests/test_oopsreferences.py b/lib/lp/registry/tests/test_oopsreferences.py
index 175795e..47e00fb 100644
--- a/lib/lp/registry/tests/test_oopsreferences.py
+++ b/lib/lp/registry/tests/test_oopsreferences.py
@@ -28,7 +28,7 @@ class TestOopsReferences(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestOopsReferences, self).setUp()
+ super().setUp()
self.store = IStore(Message)
def test_oops_in_messagechunk(self):
@@ -90,7 +90,7 @@ class TestOopsReferences(TestCaseWithFactory):
def test_oops_in_question_title(self):
oopsid = "OOPS-abcdef1234"
- question = self.factory.makeQuestion(title=u"Crash with %s" % oopsid)
+ question = self.factory.makeQuestion(title="Crash with %s" % oopsid)
self.store.flush()
now = datetime.now(tz=utc)
day = timedelta(days=1)
@@ -105,7 +105,7 @@ class TestOopsReferences(TestCaseWithFactory):
def test_oops_in_question_wrong_context(self):
oopsid = "OOPS-abcdef1234"
- question = self.factory.makeQuestion(title=u"Crash with %s" % oopsid)
+ question = self.factory.makeQuestion(title="Crash with %s" % oopsid)
self.store.flush()
now = datetime.now(tz=utc)
day = timedelta(days=1)
@@ -118,7 +118,7 @@ class TestOopsReferences(TestCaseWithFactory):
def test_oops_in_question_description(self):
oopsid = "OOPS-abcdef1234"
question = self.factory.makeQuestion(
- description=u"Crash with %s" % oopsid)
+ description="Crash with %s" % oopsid)
self.store.flush()
now = datetime.now(tz=utc)
day = timedelta(days=1)
@@ -135,7 +135,7 @@ class TestOopsReferences(TestCaseWithFactory):
oopsid = "OOPS-abcdef1234"
question = self.factory.makeQuestion()
with person_logged_in(question.owner):
- question.whiteboard = u"Crash with %s" % oopsid
+ question.whiteboard = "Crash with %s" % oopsid
self.store.flush()
now = datetime.now(tz=utc)
day = timedelta(days=1)
@@ -153,7 +153,7 @@ class TestOopsReferences(TestCaseWithFactory):
distro = self.factory.makeDistribution()
question = self.factory.makeQuestion(target=distro)
with person_logged_in(question.owner):
- question.whiteboard = u"Crash with %s" % oopsid
+ question.whiteboard = "Crash with %s" % oopsid
self.store.flush()
now = datetime.now(tz=utc)
day = timedelta(days=1)
diff --git a/lib/lp/registry/tests/test_person.py b/lib/lp/registry/tests/test_person.py
index a7df518..05a7d0e 100644
--- a/lib/lp/registry/tests/test_person.py
+++ b/lib/lp/registry/tests/test_person.py
@@ -88,7 +88,7 @@ class TestPersonTeams(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonTeams, self).setUp()
+ super().setUp()
self.user = self.factory.makePerson(name="test-member")
self.a_team = self.factory.makeTeam(name='a')
self.b_team = self.factory.makeTeam(name='b', owner=self.a_team)
@@ -428,15 +428,15 @@ class TestPerson(TestCaseWithFactory):
# Users can see their own non-public affiliated products.
owner = self.factory.makePerson()
self.factory.makeProduct(
- name=u'proprietary',
+ name='proprietary',
information_type=InformationType.PROPRIETARY,
owner=owner)
self.factory.makeProduct(
- name=u'public',
+ name='public',
information_type=InformationType.PUBLIC,
owner=owner)
- expected_pillars = [u'proprietary', u'public']
+ expected_pillars = ['proprietary', 'public']
received_pillars = [pillar.name for pillar in
owner.getAffiliatedPillars(owner)]
self.assertEqual(expected_pillars, received_pillars)
@@ -446,15 +446,15 @@ class TestPerson(TestCaseWithFactory):
owner = self.factory.makePerson()
admin = self.factory.makeAdministrator()
self.factory.makeProduct(
- name=u'proprietary',
+ name='proprietary',
information_type=InformationType.PROPRIETARY,
owner=owner)
self.factory.makeProduct(
- name=u'public',
+ name='public',
information_type=InformationType.PUBLIC,
owner=owner)
- expected_pillars = [u'proprietary', u'public']
+ expected_pillars = ['proprietary', 'public']
received_pillars = [pillar.name for pillar in
owner.getAffiliatedPillars(admin)]
self.assertEqual(expected_pillars, received_pillars)
@@ -464,15 +464,15 @@ class TestPerson(TestCaseWithFactory):
owner = self.factory.makePerson()
admin = self.factory.makeCommercialAdmin()
self.factory.makeProduct(
- name=u'proprietary',
+ name='proprietary',
information_type=InformationType.PROPRIETARY,
owner=owner)
self.factory.makeProduct(
- name=u'public',
+ name='public',
information_type=InformationType.PUBLIC,
owner=owner)
- expected_pillars = [u'proprietary', u'public']
+ expected_pillars = ['proprietary', 'public']
received_pillars = [pillar.name for pillar in
owner.getAffiliatedPillars(admin)]
self.assertEqual(expected_pillars, received_pillars)
@@ -992,7 +992,7 @@ class TestPersonStates(TestCaseWithFactory):
def test_person_repr_ansii(self):
# Verify that ANSI displayname is ascii safe.
person = self.factory.makePerson(
- name="user", displayname=u'\xdc-tester')
+ name="user", displayname='\xdc-tester')
ignore, name, displayname = repr(person).rsplit(' ', 2)
self.assertEqual('user', name)
self.assertEqual('(\\xdc-tester)>', displayname)
@@ -1000,7 +1000,7 @@ class TestPersonStates(TestCaseWithFactory):
def test_person_repr_unicode(self):
# Verify that Unicode displayname is ascii safe.
person = self.factory.makePerson(
- name="user", displayname=u'\u0170-tester')
+ name="user", displayname='\u0170-tester')
ignore, displayname = repr(person).rsplit(' ', 1)
self.assertEqual('(\\u0170-tester)>', displayname)
@@ -1010,7 +1010,7 @@ class TestPersonRelatedBugTaskSearch(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonRelatedBugTaskSearch, self).setUp()
+ super().setUp()
self.user = self.factory.makePerson(displayname="User")
self.context = self.factory.makePerson(displayname="Context")
@@ -1157,7 +1157,7 @@ class TestPersonKarma(TestCaseWithFactory, KarmaTestMixin):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonKarma, self).setUp()
+ super().setUp()
self.person = self.factory.makePerson()
a_product = self.factory.makeProduct(name='aa')
b_product = self.factory.makeProduct(name='bb')
@@ -1295,7 +1295,7 @@ class TestGetRecipients(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestGetRecipients, self).setUp()
+ super().setUp()
login('foo.bar@xxxxxxxxxxxxx')
def test_get_recipients_indirect(self):
@@ -1365,7 +1365,7 @@ class TestGetRecipients(TestCaseWithFactory):
super_team_member_team,
self.makePersonWithNoPreferredEmail()])
super_team_member_team.acceptInvitationToBeMemberOf(
- super_team, u'Go Team!')
+ super_team, 'Go Team!')
recipients = list(get_recipients(super_team))
self.assertEqual({owner,
super_team_member_person,
@@ -1410,7 +1410,7 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(Test_getAssignedSpecificationWorkItemsDueBefore, self).setUp()
+ super().setUp()
self.team = self.factory.makeTeam()
today = datetime.today().date()
next_month = today + timedelta(days=30)
@@ -1428,13 +1428,13 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory):
# Create a workitem with no explicit assignee/milestone. This way it
# will inherit the ones from the spec it belongs to.
workitem = self.factory.makeSpecificationWorkItem(
- title=u'workitem 1', specification=assigned_spec)
+ title='workitem 1', specification=assigned_spec)
# Create a workitem targeted to a milestone too far in the future.
# This workitem must not be in the list returned by
# getAssignedSpecificationWorkItemsDueBefore().
self.factory.makeSpecificationWorkItem(
- title=u'workitem 2', specification=assigned_spec,
+ title='workitem 2', specification=assigned_spec,
milestone=self.future_milestone)
workitems = self.team.getAssignedSpecificationWorkItemsDueBefore(
@@ -1448,7 +1448,7 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory):
product=self.product)
# Create a deleted work item.
self.factory.makeSpecificationWorkItem(
- title=u'workitem', specification=assigned_spec, deleted=True)
+ title='workitem', specification=assigned_spec, deleted=True)
workitems = self.team.getAssignedSpecificationWorkItemsDueBefore(
self.current_milestone.dateexpected, self.team)
@@ -1461,13 +1461,13 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory):
# Create a workitem with no explicit assignee/milestone. This way it
# will inherit the ones from the spec it belongs to.
workitem = self.factory.makeSpecificationWorkItem(
- title=u'workitem 1', specification=assigned_spec)
+ title='workitem 1', specification=assigned_spec)
# Create a workitem with somebody who's not a member of our team as
# the assignee. This workitem must be in the list returned by
# getAssignedSpecificationWorkItemsDueBefore().
workitem_for_other_person = self.factory.makeSpecificationWorkItem(
- title=u'workitem 2', specification=assigned_spec,
+ title='workitem 2', specification=assigned_spec,
assignee=self.factory.makePerson())
workitems = self.team.getAssignedSpecificationWorkItemsDueBefore(
@@ -1484,7 +1484,7 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory):
assignee=self.team.teamowner, milestone=milestone,
product=milestone.product)
self.factory.makeSpecificationWorkItem(
- title=u'workitem 1', specification=spec)
+ title='workitem 1', specification=spec)
workitems = self.team.getAssignedSpecificationWorkItemsDueBefore(
today, self.team)
@@ -1498,12 +1498,12 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory):
# This workitem inherits the spec's milestone and that's too far in
# the future so it won't be in the returned list.
self.factory.makeSpecificationWorkItem(
- title=u'workitem 1', specification=assigned_spec)
+ title='workitem 1', specification=assigned_spec)
# This one, on the other hand, is explicitly targeted to the current
# milestone, so it is included in the returned list even though its
# spec is targeted to the future milestone.
workitem = self.factory.makeSpecificationWorkItem(
- title=u'workitem 2', specification=assigned_spec,
+ title='workitem 2', specification=assigned_spec,
milestone=self.current_milestone)
workitems = self.team.getAssignedSpecificationWorkItemsDueBefore(
@@ -1521,13 +1521,13 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory):
# This one is not explicitly assigned to anyone, so it inherits the
# assignee of its spec and hence is not in the returned list.
self.factory.makeSpecificationWorkItem(
- title=u'workitem 1', specification=foreign_spec)
+ title='workitem 1', specification=foreign_spec)
# This one, on the other hand, is explicitly assigned to the a member
# of our team, so it is included in the returned list even though its
# spec is not assigned to a member of our team.
workitem = self.factory.makeSpecificationWorkItem(
- title=u'workitem 2', specification=foreign_spec,
+ title='workitem 2', specification=foreign_spec,
assignee=self.team.teamowner)
workitems = self.team.getAssignedSpecificationWorkItemsDueBefore(
@@ -1588,11 +1588,11 @@ class Test_getAssignedSpecificationWorkItemsDueBefore(TestCaseWithFactory):
for i in range(5):
spec = self._makeProductSpec(dateexpected)
self.factory.makeSpecificationWorkItem(
- title=u'product work item %d' % i, assignee=spec.assignee,
+ title='product work item %d' % i, assignee=spec.assignee,
milestone=spec.milestone, specification=spec)
spec2 = self._makeDistroSpec(dateexpected)
self.factory.makeSpecificationWorkItem(
- title=u'distro work item %d' % i, assignee=spec2.assignee,
+ title='distro work item %d' % i, assignee=spec2.assignee,
milestone=spec2.milestone, specification=spec2)
flush_database_updates()
flush_database_caches()
@@ -1622,7 +1622,7 @@ class Test_getAssignedBugTasksDueBefore(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(Test_getAssignedBugTasksDueBefore, self).setUp()
+ super().setUp()
self.team = self.factory.makeTeam()
self.today = datetime.today().date()
@@ -1804,7 +1804,7 @@ class TestSpecifications(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestSpecifications, self).setUp()
+ super().setUp()
self.date_created = datetime.now(pytz.utc)
def makeSpec(self, owner=None, date_created=0, title=None,
@@ -1988,9 +1988,9 @@ class TestSpecifications(TestCaseWithFactory):
blueprint1 = self.makeSpec(title='abc')
owner = blueprint1.owner
blueprint2 = self.makeSpec(owner, title='def')
- result = list_result(owner, [u'abc'])
+ result = list_result(owner, ['abc'])
self.assertEqual([blueprint1], result)
- result = list_result(owner, [u'def'])
+ result = list_result(owner, ['def'])
self.assertEqual([blueprint2], result)
def test_proprietary_not_listed(self):
diff --git a/lib/lp/registry/tests/test_person_close_account_job.py b/lib/lp/registry/tests/test_person_close_account_job.py
index f7ecc35..26e3d50 100644
--- a/lib/lp/registry/tests/test_person_close_account_job.py
+++ b/lib/lp/registry/tests/test_person_close_account_job.py
@@ -42,7 +42,7 @@ class TestPersonCloseAccountJob(TestCaseWithFactory):
layer = LaunchpadZopelessLayer
def test_close_account_job_valid_username(self):
- user_to_delete = self.factory.makePerson(name=u'delete-me')
+ user_to_delete = self.factory.makePerson(name='delete-me')
job_source = getUtility(IPersonCloseAccountJobSource)
jobs = list(job_source.iterReady())
@@ -57,11 +57,11 @@ class TestPersonCloseAccountJob(TestCaseWithFactory):
self.assertEqual(JobStatus.COMPLETED, jobs[0].status)
person = removeSecurityProxy(
getUtility(IPersonSet).getByName(user_to_delete.name))
- self.assertEqual(person.name, u'removed%d' % user_to_delete.id)
+ self.assertEqual(person.name, 'removed%d' % user_to_delete.id)
def test_close_account_job_valid_email(self):
user_to_delete = self.factory.makePerson(
- email=u'delete-me@xxxxxxxxxxx')
+ email='delete-me@xxxxxxxxxxx')
getUtility(
IPersonCloseAccountJobSource).create(user_to_delete)
job_source = getUtility(IPersonCloseAccountJobSource)
@@ -71,7 +71,7 @@ class TestPersonCloseAccountJob(TestCaseWithFactory):
self.assertEqual(JobStatus.COMPLETED, jobs[0].status)
person = removeSecurityProxy(
getUtility(IPersonSet).getByName(user_to_delete.name))
- self.assertEqual(person.name, u'removed%d' % user_to_delete.id)
+ self.assertEqual(person.name, 'removed%d' % user_to_delete.id)
def test_team(self):
team = self.factory.makeTeam()
@@ -82,7 +82,7 @@ class TestPersonCloseAccountJob(TestCaseWithFactory):
team)
def test_unhandled_reference(self):
- user_to_delete = self.factory.makePerson(name=u'delete-me')
+ user_to_delete = self.factory.makePerson(name='delete-me')
self.factory.makeProduct(owner=user_to_delete)
person = removeSecurityProxy(
getUtility(IPersonSet).getByName(user_to_delete.name))
@@ -94,10 +94,10 @@ class TestPersonCloseAccountJob(TestCaseWithFactory):
dbuser(config.IPersonCloseAccountJobSource.dbuser):
job.run()
error_message = (
- {u'ERROR User delete-me is still '
- u'referenced by 1 product.owner values',
- u'ERROR User delete-me is still '
- u'referenced by 1 productseries.owner values',
+ {'ERROR User delete-me is still '
+ 'referenced by 1 product.owner values',
+ 'ERROR User delete-me is still '
+ 'referenced by 1 productseries.owner values',
})
self.assertTrue(
error_message.issubset(logger.getLogBuffer().splitlines()))
@@ -133,4 +133,4 @@ class TestPersonCloseAccountJobViaCelery(TestCaseWithFactory):
person = removeSecurityProxy(
getUtility(IPersonSet).getByName(user_to_delete.name))
self.assertEqual(JobStatus.COMPLETED, job.status)
- self.assertEqual(person.name, u'removed%d' % user_to_delete.id)
+ self.assertEqual(person.name, 'removed%d' % user_to_delete.id)
diff --git a/lib/lp/registry/tests/test_person_merge_job.py b/lib/lp/registry/tests/test_person_merge_job.py
index 99f943d..fcf0ca5 100644
--- a/lib/lp/registry/tests/test_person_merge_job.py
+++ b/lib/lp/registry/tests/test_person_merge_job.py
@@ -64,7 +64,7 @@ class TestPersonMergeJob(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonMergeJob, self).setUp()
+ super().setUp()
self.job_source = getUtility(IPersonMergeJobSource)
self.job = create_job(self.factory)
self.from_person = self.job.from_person
diff --git a/lib/lp/registry/tests/test_person_sort_key.py b/lib/lp/registry/tests/test_person_sort_key.py
index 64b82bb..ec45cb8 100644
--- a/lib/lp/registry/tests/test_person_sort_key.py
+++ b/lib/lp/registry/tests/test_person_sort_key.py
@@ -14,41 +14,41 @@ class TestPersonSortKeyBase:
# person_sort_key returns the concatenation of the display name and
# the name for use in sorting.
self.assertSortKeysEqual(
- u"Stuart Bishop", u"stub",
- u"stuart bishop, stub")
+ "Stuart Bishop", "stub",
+ "stuart bishop, stub")
def test_whitespace(self):
# Leading and trailing whitespace is removed.
self.assertSortKeysEqual(
- u" Stuart Bishop\t", u"stub",
- u"stuart bishop, stub")
+ " Stuart Bishop\t", "stub",
+ "stuart bishop, stub")
def test_valid_name_is_assumed(self):
# 'name' is assumed to be lowercase and not containing anything we
# don't want. This should never happen as the valid_name database
# constraint should prevent it.
self.assertSortKeysEqual(
- u"Stuart Bishop", u" stub42!!!",
- u"stuart bishop, stub42!!!")
+ "Stuart Bishop", " stub42!!!",
+ "stuart bishop, stub42!!!")
def test_strip_all_but_letters_and_whitespace(self):
# Everything except for letters and whitespace is stripped.
self.assertSortKeysEqual(
- u"-= Mass1v3 T0SSA =-", u"tossa",
- u"massv tssa, tossa")
+ "-= Mass1v3 T0SSA =-", "tossa",
+ "massv tssa, tossa")
def test_non_ascii_allowed(self):
# Non ASCII letters are currently allowed. Eventually they should
# become transliterated to ASCII but we don't do this yet.
self.assertSortKeysEqual(
- u"Bj\N{LATIN SMALL LETTER O WITH DIAERESIS}rn", "bjorn",
- u"bj\xf6rn, bjorn")
+ "Bj\N{LATIN SMALL LETTER O WITH DIAERESIS}rn", "bjorn",
+ "bj\xf6rn, bjorn")
def test_unicode_case_conversion(self):
# Case conversion is handled correctly using Unicode.
self.assertSortKeysEqual(
- u"Bj\N{LATIN CAPITAL LETTER O WITH DIAERESIS}rn", "bjorn",
- u"bj\xf6rn, bjorn") # Lower case o with diaeresis
+ "Bj\N{LATIN CAPITAL LETTER O WITH DIAERESIS}rn", "bjorn",
+ "bj\xf6rn, bjorn") # Lower case o with diaeresis
class TestPersonSortKeyInDatabase(TestPersonSortKeyBase, TestCase):
@@ -56,12 +56,12 @@ class TestPersonSortKeyInDatabase(TestPersonSortKeyBase, TestCase):
layer = DatabaseLayer
def setUp(self):
- super(TestPersonSortKeyInDatabase, self).setUp()
+ super().setUp()
self.con = self.layer.connect()
self.cur = self.con.cursor()
def tearDown(self):
- super(TestPersonSortKeyInDatabase, self).tearDown()
+ super().tearDown()
self.con.close()
def get_person_sort_key(self, display_name, name):
diff --git a/lib/lp/registry/tests/test_person_vocabularies.py b/lib/lp/registry/tests/test_person_vocabularies.py
index ea0cfcc..20a9d94 100644
--- a/lib/lp/registry/tests/test_person_vocabularies.py
+++ b/lib/lp/registry/tests/test_person_vocabularies.py
@@ -37,7 +37,7 @@ class VocabularyTestBase:
vocabulary_name = None
def setUp(self):
- super(VocabularyTestBase, self).setUp()
+ super().setUp()
self.vocabulary_registry = getVocabularyRegistry()
def getVocabulary(self, context):
@@ -85,18 +85,18 @@ class ValidPersonOrTeamVocabularyMixin(VocabularyTestBase):
# Exact is better than prefix is better than FTI.
self.assertEqual(
[exact_person, prefix_person, contributor_person],
- list(self.searchVocabulary(product, u'fooix')))
+ list(self.searchVocabulary(product, 'fooix')))
# But karma can bump people up, behind the exact match.
self.addKarma(contributor_person, 500, product=product)
self.assertEqual(
[exact_person, contributor_person, prefix_person],
- list(self.searchVocabulary(product, u'fooix')))
+ list(self.searchVocabulary(product, 'fooix')))
self.addKarma(prefix_person, 500, product=product)
self.assertEqual(
[exact_person, prefix_person, contributor_person],
- list(self.searchVocabulary(product, u'fooix')))
+ list(self.searchVocabulary(product, 'fooix')))
def assertKarmaContextConstraint(self, expected, context):
"""Check that the karma context constraint works.
@@ -138,7 +138,7 @@ class ValidPersonOrTeamVocabularyMixin(VocabularyTestBase):
results = self.searchVocabulary(None, '', 'PERSON')
for personorteam in results:
self.assertFalse(personorteam.is_team)
- results = self.searchVocabulary(None, u'fred', 'PERSON')
+ results = self.searchVocabulary(None, 'fred', 'PERSON')
self.assertEqual([person], list(results))
def test_person_filter(self):
@@ -153,7 +153,7 @@ class ValidPersonOrTeamVocabularyMixin(VocabularyTestBase):
results = self.searchVocabulary(None, '', 'TEAM')
for personorteam in results:
self.assertTrue(personorteam.is_team)
- results = self.searchVocabulary(None, u'fred', 'TEAM')
+ results = self.searchVocabulary(None, 'fred', 'TEAM')
self.assertContentEqual(teams, list(results))
def test_inactive_people_ignored(self):
@@ -229,7 +229,7 @@ class TestValidPersonOrTeamPreloading(VocabularyTestBase,
person.id: person.preferredemail for person in people}
Store.of(people[0]).invalidate()
- results = list(self.searchVocabulary(None, u'foobar'))
+ results = list(self.searchVocabulary(None, 'foobar'))
with StormStatementRecorder() as recorder:
self.assertEqual(4, len(results))
for person in results:
diff --git a/lib/lp/registry/tests/test_personmerge.py b/lib/lp/registry/tests/test_personmerge.py
index 0b5e264..cf53fbd 100644
--- a/lib/lp/registry/tests/test_personmerge.py
+++ b/lib/lp/registry/tests/test_personmerge.py
@@ -80,7 +80,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestMergePeople, self).setUp()
+ super().setUp()
self.person_set = getUtility(IPersonSet)
def _do_premerge(self, from_person, to_person):
@@ -281,7 +281,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
duplicate, mergee = self._do_merge(duplicate, mergee)
branches = [b.name for b in mergee.getBranches()]
self.assertEqual(2, len(branches))
- self.assertContentEqual([u'foo', u'foo-1'], branches)
+ self.assertContentEqual(['foo', 'foo-1'], branches)
def test_merge_moves_git_repositories(self):
# When person/teams are merged, Git repositories owned by the from
@@ -301,9 +301,9 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
# name, merging renames the duplicate from the from person's side.
project = self.factory.makeProduct()
from_repository = self.factory.makeGitRepository(
- target=project, name=u'foo')
+ target=project, name='foo')
to_repository = self.factory.makeGitRepository(
- target=project, name=u'foo')
+ target=project, name='foo')
mergee = to_repository.owner
duplicate = from_repository.owner
self._do_premerge(duplicate, mergee)
@@ -313,7 +313,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
repositories = [
r.name for r in repository_set.getRepositories(None, mergee)]
self.assertEqual(2, len(repositories))
- self.assertContentEqual([u'foo', u'foo-1'], repositories)
+ self.assertContentEqual(['foo', 'foo-1'], repositories)
def test_merge_moves_recipes(self):
# When person/teams are merged, recipes owned by the from person are
@@ -333,9 +333,9 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
# If both the from and to people have recipes with the same name,
# merging renames the duplicate from the from person's side.
merge_from = self.factory.makeSourcePackageRecipe(
- name=u'foo', description=u'FROM')
+ name='foo', description='FROM')
merge_to = self.factory.makeSourcePackageRecipe(
- name=u'foo', description=u'TO')
+ name='foo', description='TO')
duplicate = merge_from.owner
mergee = merge_to.owner
# Delete merge_from's PPA, which is required for the merge to work.
@@ -347,8 +347,8 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
recipes = mergee.recipes
self.assertEqual(2, recipes.count())
descriptions = [r.description for r in recipes]
- self.assertEqual([u'TO', u'FROM'], descriptions)
- self.assertEqual(u'foo-1', recipes[1].name)
+ self.assertEqual(['TO', 'FROM'], descriptions)
+ self.assertEqual('foo-1', recipes[1].name)
def assertSubscriptionMerges(self, target):
# Given a subscription target, we want to make sure that subscriptions
@@ -378,7 +378,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
# The description lets us show that we still have the right
# subscription later.
target.addBugSubscriptionFilter(person, person).description = (
- u'a marker')
+ 'a marker')
self._do_premerge(duplicate, person)
login_person(person)
duplicate, person = self._do_merge(duplicate, person)
@@ -386,7 +386,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
# by the marker name.
self.assertEqual(
target.getSubscription(person).bug_filters[0].description,
- u'a marker')
+ 'a marker')
# The conflicting subscription on the duplicate has been deleted.
self.assertTrue(target.getSubscription(duplicate) is None)
@@ -543,7 +543,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
rule=rule, grantee=other_person, can_push=True)
other_rule = self.factory.makeGitRule(
- rule.repository, ref_pattern=u"refs/heads/other/*")
+ rule.repository, ref_pattern="refs/heads/other/*")
self.factory.makeGitRuleGrant(
rule=other_rule, grantee=other_person, can_force_push=True)
@@ -607,7 +607,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
def test_merge_moves_livefses(self):
# When person/teams are merged, live filesystems owned by the from
# person are moved.
- self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"}))
+ self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}))
duplicate = self.factory.makePerson()
mergee = self.factory.makePerson()
self.factory.makeLiveFS(registrant=duplicate, owner=duplicate)
@@ -619,14 +619,14 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
def test_merge_with_duplicated_livefses(self):
# If both the from and to people have live filesystems with the same
# name, merging renames the duplicate from the from person's side.
- self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"}))
+ self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"}))
duplicate = self.factory.makePerson()
mergee = self.factory.makePerson()
self.factory.makeLiveFS(
- registrant=duplicate, owner=duplicate, name=u'foo',
+ registrant=duplicate, owner=duplicate, name='foo',
metadata={'project': 'FROM'})
self.factory.makeLiveFS(
- registrant=mergee, owner=mergee, name=u'foo',
+ registrant=mergee, owner=mergee, name='foo',
metadata={'project': 'TO'})
self._do_premerge(duplicate, mergee)
login_person(mergee)
@@ -635,7 +635,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
self.assertEqual(2, livefses.count())
project_names = [livefs.metadata['project'] for livefs in livefses]
self.assertEqual(['TO', 'FROM'], project_names)
- self.assertEqual(u'foo-1', livefses[1].name)
+ self.assertEqual('foo-1', livefses[1].name)
def test_merge_moves_snaps(self):
# When person/teams are merged, snap packages owned by the from
@@ -656,9 +656,9 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
branch = self.factory.makeAnyBranch()
[ref] = self.factory.makeGitRefs()
self.factory.makeSnap(
- registrant=duplicate, owner=duplicate, name=u'foo', branch=branch)
+ registrant=duplicate, owner=duplicate, name='foo', branch=branch)
self.factory.makeSnap(
- registrant=mergee, owner=mergee, name=u'foo', git_ref=ref)
+ registrant=mergee, owner=mergee, name='foo', git_ref=ref)
self._do_premerge(duplicate, mergee)
login_person(mergee)
duplicate, mergee = self._do_merge(duplicate, mergee)
@@ -668,11 +668,11 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
self.assertIsNone(snaps[0].branch)
self.assertEqual(ref.repository, snaps[0].git_repository)
self.assertEqual(ref.path, snaps[0].git_path)
- self.assertEqual(u'foo', snaps[0].name)
+ self.assertEqual('foo', snaps[0].name)
self.assertEqual(branch, snaps[1].branch)
self.assertIsNone(snaps[1].git_repository)
self.assertIsNone(snaps[1].git_path)
- self.assertEqual(u'foo-1', snaps[1].name)
+ self.assertEqual('foo-1', snaps[1].name)
def test_merge_snapsubscription(self):
# Checks that merging users moves subscriptions.
@@ -681,7 +681,7 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
mergee = self.factory.makePerson()
snap = removeSecurityProxy(self.factory.makeSnap(
owner=duplicate, registrant=duplicate,
- name=u'foo', private=True))
+ name='foo', private=True))
with admin_logged_in():
# Owner should have being subscribed automatically on creation.
@@ -724,12 +724,12 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'}))
duplicate = self.factory.makePerson()
mergee = self.factory.makePerson()
- [ref] = self.factory.makeGitRefs(paths=[u'refs/heads/v1.0-20.04'])
- [ref2] = self.factory.makeGitRefs(paths=[u'refs/heads/v1.0-20.04'])
+ [ref] = self.factory.makeGitRefs(paths=['refs/heads/v1.0-20.04'])
+ [ref2] = self.factory.makeGitRefs(paths=['refs/heads/v1.0-20.04'])
self.factory.makeOCIRecipe(
- registrant=duplicate, owner=duplicate, name=u'foo', git_ref=ref)
+ registrant=duplicate, owner=duplicate, name='foo', git_ref=ref)
self.factory.makeOCIRecipe(
- registrant=mergee, owner=mergee, name=u'foo', git_ref=ref2)
+ registrant=mergee, owner=mergee, name='foo', git_ref=ref2)
self._do_premerge(duplicate, mergee)
login_person(mergee)
duplicate, mergee = self._do_merge(duplicate, mergee)
@@ -740,11 +740,11 @@ class TestMergePeople(TestCaseWithFactory, KarmaTestMixin):
self.assertEqual(ref2, oci_recipes[0].git_ref)
self.assertEqual(ref2.repository, oci_recipes[0].git_repository)
self.assertEqual(ref2.path, oci_recipes[0].git_path)
- self.assertEqual(u'foo', oci_recipes[0].name)
+ self.assertEqual('foo', oci_recipes[0].name)
self.assertEqual(ref, oci_recipes[1].git_ref)
self.assertEqual(ref.repository, oci_recipes[1].git_repository)
self.assertEqual(ref.path, oci_recipes[1].git_path)
- self.assertEqual(u'foo-1', oci_recipes[1].name)
+ self.assertEqual('foo-1', oci_recipes[1].name)
def test_merge_moves_charm_recipes(self):
# When person/teams are merged, charm recipes owned by the from
diff --git a/lib/lp/registry/tests/test_personnotification.py b/lib/lp/registry/tests/test_personnotification.py
index ce0df42..1f0854c 100644
--- a/lib/lp/registry/tests/test_personnotification.py
+++ b/lib/lp/registry/tests/test_personnotification.py
@@ -30,14 +30,14 @@ class TestPersonNotification(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonNotification, self).setUp()
+ super().setUp()
self.notification_set = getUtility(IPersonNotificationSet)
def test_to_addresses_user(self):
# The to_addresses list is the user's preferred email address.
user = self.factory.makePerson()
notification = self.notification_set.addNotification(
- user, u'subject', u'body')
+ user, 'subject', 'body')
email = '%s <%s>' % (
user.displayname, removeSecurityProxy(user.preferredemail).email)
self.assertEqual([email], notification.to_addresses)
@@ -48,7 +48,7 @@ class TestPersonNotification(TestCaseWithFactory):
user = self.factory.makePerson()
user.setPreferredEmail(None)
notification = self.notification_set.addNotification(
- user, u'subject', u'body')
+ user, 'subject', 'body')
self.assertEqual([], notification.to_addresses)
self.assertFalse(notification.can_send)
@@ -56,7 +56,7 @@ class TestPersonNotification(TestCaseWithFactory):
# The to_addresses list is the team admin addresses.
team = self.factory.makeTeam()
notification = self.notification_set.addNotification(
- team, u'subject', u'body')
+ team, 'subject', 'body')
email = removeSecurityProxy(team.teamowner.preferredemail).email
self.assertEqual([email], notification.to_addresses)
self.assertTrue(notification.can_send)
@@ -68,20 +68,20 @@ class TestPersonNotificationManager(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonNotificationManager, self).setUp()
+ super().setUp()
logging.basicConfig(level=logging.CRITICAL)
logger = logging.getLogger()
self.manager = PersonNotificationManager(transaction, logger)
self.notification_set = getUtility(IPersonNotificationSet)
def tearDown(self):
- super(TestPersonNotificationManager, self).tearDown()
+ super().tearDown()
reset_logging()
def test_sendNotifications_sent(self):
user = self.factory.makePerson()
notification = self.notification_set.addNotification(
- user, u'subject', u'body')
+ user, 'subject', 'body')
unsent = self.manager.sendNotifications()
self.assertEqual(None, unsent)
self.assertIsNotNone(notification.date_emailed)
@@ -89,7 +89,7 @@ class TestPersonNotificationManager(TestCaseWithFactory):
def test_sendNotifications_unsent(self):
user = self.factory.makePerson()
notification = self.notification_set.addNotification(
- user, u'subject', u'body')
+ user, 'subject', 'body')
user.setPreferredEmail(None)
unsent = self.manager.sendNotifications()
self.assertEqual([notification], unsent)
@@ -99,7 +99,7 @@ class TestPersonNotificationManager(TestCaseWithFactory):
team = self.factory.makeTeam()
self.assertIs(None, team.preferredemail)
notification = self.notification_set.addNotification(
- team, u'subject', u'body')
+ team, 'subject', 'body')
unsent = self.manager.sendNotifications()
self.assertEqual(None, unsent)
self.assertIsNotNone(notification.date_emailed)
@@ -107,7 +107,7 @@ class TestPersonNotificationManager(TestCaseWithFactory):
def test_purgeNotifications_old(self):
user = self.factory.makePerson()
notification = self.notification_set.addNotification(
- user, u'subject', u'body')
+ user, 'subject', 'body')
age = timedelta(
days=int(config.person_notification.retained_days) + 1)
naked_notification = removeSecurityProxy(notification)
@@ -120,7 +120,7 @@ class TestPersonNotificationManager(TestCaseWithFactory):
def test_purgeNotifications_extra(self):
user = self.factory.makePerson()
notification = self.notification_set.addNotification(
- user, u'subject', u'body')
+ user, 'subject', 'body')
user.setPreferredEmail(None)
self.manager.purgeNotifications(extra_notifications=[notification])
notifcations = self.notification_set.getNotificationsToSend()
diff --git a/lib/lp/registry/tests/test_personroles.py b/lib/lp/registry/tests/test_personroles.py
index 8ebb402..0bddc7a 100644
--- a/lib/lp/registry/tests/test_personroles.py
+++ b/lib/lp/registry/tests/test_personroles.py
@@ -21,7 +21,7 @@ class TestPersonRoles(TestCaseWithFactory):
prefix = 'in_'
def setUp(self):
- super(TestPersonRoles, self).setUp()
+ super().setUp()
self.person = self.factory.makePerson()
self.celebs = getUtility(ILaunchpadCelebrities)
diff --git a/lib/lp/registry/tests/test_personset.py b/lib/lp/registry/tests/test_personset.py
index cccc95d..3137f94 100644
--- a/lib/lp/registry/tests/test_personset.py
+++ b/lib/lp/registry/tests/test_personset.py
@@ -105,7 +105,7 @@ class TestPersonSet(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonSet, self).setUp()
+ super().setUp()
login(ANONYMOUS)
self.addCleanup(logout)
self.person_set = getUtility(IPersonSet)
@@ -119,7 +119,7 @@ class TestPersonSet(TestCaseWithFactory):
def test_isNameBlacklisted_user_is_admin(self):
team = self.factory.makeTeam()
name_blacklist_set = getUtility(INameBlacklistSet)
- self.admin_exp = name_blacklist_set.create(u'fnord', admin=team)
+ self.admin_exp = name_blacklist_set.create('fnord', admin=team)
self.store = IStore(self.admin_exp)
self.store.flush()
user = team.teamowner
@@ -177,7 +177,7 @@ class TestPersonSet(TestCaseWithFactory):
# getPrecachedPersonsFromIDs() sets preferredemail to the preferred
# address if it exists, but otherwise leaves it as none.
team_no_contact = self.factory.makeTeam(email=None)
- team_contact = self.factory.makeTeam(email=u'team@xxxxxxxxxxx')
+ team_contact = self.factory.makeTeam(email='team@xxxxxxxxxxx')
team_list = self.factory.makeTeam(email=None)
self.factory.makeMailingList(team_list, team_list.teamowner)
person_normal = self.factory.makePerson()
@@ -228,9 +228,9 @@ class TestPersonSet(TestCaseWithFactory):
with person_logged_in(person):
identifier = person.account.openid_identifiers.one().identifier
for id_url in (
- u'http://testopenid.test/+id/%s' % identifier,
- u'http://login1.test/+id/%s' % identifier,
- u'http://login2.test/+id/%s' % identifier):
+ 'http://testopenid.test/+id/%s' % identifier,
+ 'http://login1.test/+id/%s' % identifier,
+ 'http://login2.test/+id/%s' % identifier):
self.assertEqual(
person, self.person_set.getByOpenIDIdentifier(id_url))
@@ -239,7 +239,7 @@ class TestPersonSet(TestCaseWithFactory):
self.assertIs(
None,
self.person_set.getByOpenIDIdentifier(
- u'http://testopenid.test/+id/notanid'))
+ 'http://testopenid.test/+id/notanid'))
def test_getByOpenIDIdentifier_for_bad_domain_is_none(self):
# Even though the OpenIDIdentifier table doesn't store the
@@ -251,13 +251,13 @@ class TestPersonSet(TestCaseWithFactory):
self.assertIs(
None,
self.person_set.getByOpenIDIdentifier(
- u'http://not.launchpad.test/+id/%s' % identifier))
+ 'http://not.launchpad.test/+id/%s' % identifier))
def test_find__accepts_queries_with_or_operator(self):
# PersonSet.find() allows to search for OR combined terms.
person_one = self.factory.makePerson(name='baz')
person_two = self.factory.makeTeam(name='blah')
- result = list(self.person_set.find(u'baz OR blah'))
+ result = list(self.person_set.find('baz OR blah'))
self.assertEqual([person_one, person_two], result)
def test_findPerson__accepts_queries_with_or_operator(self):
@@ -266,11 +266,11 @@ class TestPersonSet(TestCaseWithFactory):
name='baz', email='one@xxxxxxxxxxx')
person_two = self.factory.makePerson(
name='blah', email='two@xxxxxxxxxxx')
- result = list(self.person_set.findPerson(u'baz OR blah'))
+ result = list(self.person_set.findPerson('baz OR blah'))
self.assertEqual([person_one, person_two], result)
# Note that these OR searches do not work for email addresses.
result = list(self.person_set.findPerson(
- u'one@xxxxxxxxxxx OR two@xxxxxxxxxxx'))
+ 'one@xxxxxxxxxxx OR two@xxxxxxxxxxx'))
self.assertEqual([], result)
def test_findPerson__case_insensitive_email_address_search(self):
@@ -279,29 +279,29 @@ class TestPersonSet(TestCaseWithFactory):
name='baz', email='ONE@xxxxxxxxxxx')
person_two = self.factory.makePerson(
name='blah', email='two@xxxxxxxxxxx')
- result = list(self.person_set.findPerson(u'one@xxxxxxxxxxx'))
+ result = list(self.person_set.findPerson('one@xxxxxxxxxxx'))
self.assertEqual([person_one], result)
- result = list(self.person_set.findPerson(u'TWO@xxxxxxxxxxx'))
+ result = list(self.person_set.findPerson('TWO@xxxxxxxxxxx'))
self.assertEqual([person_two], result)
def test_findTeam__accepts_queries_with_or_operator(self):
# PersonSet.findTeam() allows to search for OR combined terms.
team_one = self.factory.makeTeam(name='baz', email='ONE@xxxxxxxxxxx')
team_two = self.factory.makeTeam(name='blah', email='TWO@xxxxxxxxxxx')
- result = list(self.person_set.findTeam(u'baz OR blah'))
+ result = list(self.person_set.findTeam('baz OR blah'))
self.assertEqual([team_one, team_two], result)
# Note that these OR searches do not work for email addresses.
result = list(self.person_set.findTeam(
- u'one@xxxxxxxxxxx OR two@xxxxxxxxxxx'))
+ 'one@xxxxxxxxxxx OR two@xxxxxxxxxxx'))
self.assertEqual([], result)
def test_findTeam__case_insensitive_email_address_search(self):
# A search for email addresses is case insensitve.
team_one = self.factory.makeTeam(name='baz', email='ONE@xxxxxxxxxxx')
team_two = self.factory.makeTeam(name='blah', email='TWO@xxxxxxxxxxx')
- result = list(self.person_set.findTeam(u'one@xxxxxxxxxxx'))
+ result = list(self.person_set.findTeam('one@xxxxxxxxxxx'))
self.assertEqual([team_one], result)
- result = list(self.person_set.findTeam(u'TWO@xxxxxxxxxxx'))
+ result = list(self.person_set.findTeam('TWO@xxxxxxxxxxx'))
self.assertEqual([team_two], result)
@@ -309,13 +309,13 @@ class TestPersonSetCreateByOpenId(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonSetCreateByOpenId, self).setUp()
+ super().setUp()
self.person_set = getUtility(IPersonSet)
self.store = IMasterStore(Account)
# Generate some valid test data.
self.account = self.makeAccount()
- self.identifier = make_openid_identifier(self.account, u'whatever')
+ self.identifier = make_openid_identifier(self.account, 'whatever')
self.person = self.makePerson(self.account)
self.email = self.makeEmailAddress(
email='whatever@xxxxxxxxxxx', person=self.person)
@@ -374,7 +374,7 @@ class TestPersonSetCreateByOpenId(TestCaseWithFactory):
def testNewOpenId(self):
# Account looked up by email and the new OpenId identifier
# attached. We can do this because we trust our OpenId Provider.
- new_identifier = u'newident'
+ new_identifier = 'newident'
found, updated = self.person_set.getOrCreateByOpenIDIdentifier(
new_identifier, self.email.email, 'Ignored Name',
PersonCreationRationale.UNKNOWN, 'No Comment')
@@ -399,8 +399,8 @@ class TestPersonSetCreateByOpenId(TestCaseWithFactory):
def testNewAccountAndIdentifier(self):
# If neither the OpenId Identifier nor the email address are
# found, we create everything.
- new_email = u'new_email@xxxxxxxxxxx'
- new_identifier = u'new_identifier'
+ new_email = 'new_email@xxxxxxxxxxx'
+ new_identifier = 'new_identifier'
found, updated = self.person_set.getOrCreateByOpenIDIdentifier(
new_identifier, new_email, 'New Name',
PersonCreationRationale.UNKNOWN, 'No Comment')
@@ -422,7 +422,7 @@ class TestPersonSetCreateByOpenId(TestCaseWithFactory):
self.email.account = None
self.email.status = EmailAddressStatus.NEW
self.person.account = None
- new_identifier = u'new_identifier'
+ new_identifier = 'new_identifier'
found, updated = self.person_set.getOrCreateByOpenIDIdentifier(
new_identifier, self.email.email, 'Ignored',
PersonCreationRationale.UNKNOWN, 'No Comment')
@@ -459,7 +459,7 @@ class TestPersonSetCreateByOpenId(TestCaseWithFactory):
def testEmptyOpenIDIdentifier(self):
self.assertRaises(
AssertionError,
- self.person_set.getOrCreateByOpenIDIdentifier, u'', 'foo@xxxxxxx',
+ self.person_set.getOrCreateByOpenIDIdentifier, '', 'foo@xxxxxxx',
'New Name', PersonCreationRationale.UNKNOWN, 'No Comment')
def testTeamEmailAddress(self):
@@ -471,7 +471,7 @@ class TestPersonSetCreateByOpenId(TestCaseWithFactory):
self.assertRaises(
TeamEmailAddressError,
self.person_set.getOrCreateByOpenIDIdentifier,
- u'other-openid-identifier', 'foo@xxxxxxx', 'New Name',
+ 'other-openid-identifier', 'foo@xxxxxxx', 'New Name',
PersonCreationRationale.UNKNOWN, 'No Comment')
def testDeactivatedAccount(self):
@@ -491,9 +491,9 @@ class TestPersonSetCreateByOpenId(TestCaseWithFactory):
def testPlaceholderAccount(self):
# Logging into a username placeholder account activates the
# account and adds the email address.
- email = u'placeholder@xxxxxxxxxxx'
- openid = u'placeholder-id'
- name = u'placeholder'
+ email = 'placeholder@xxxxxxxxxxx'
+ openid = 'placeholder-id'
+ name = 'placeholder'
person = self.person_set.createPlaceholderPerson(openid, name)
self.assertEqual(AccountStatus.PLACEHOLDER, person.account.status)
original_created = person.datecreated
@@ -609,7 +609,7 @@ class TestPersonSetGetOrCreateByOpenIDIdentifier(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonSetGetOrCreateByOpenIDIdentifier, self).setUp()
+ super().setUp()
self.person_set = getUtility(IPersonSet)
def callGetOrCreate(self, identifier, email='a@xxxxx'):
@@ -668,10 +668,10 @@ class TestPersonSetGetOrCreateByOpenIDIdentifier(TestCaseWithFactory):
def test_no_account_or_email(self):
# An identifier can be used to create an account (it is assumed
# to be already authenticated with SSO).
- person, db_updated = self.callGetOrCreate(u'openid-identifier')
+ person, db_updated = self.callGetOrCreate('openid-identifier')
self.assertEqual(
- u"openid-identifier", removeSecurityProxy(
+ "openid-identifier", removeSecurityProxy(
person.account).openid_identifiers.any().identifier)
self.assertTrue(db_updated)
@@ -681,11 +681,11 @@ class TestPersonSetGetOrCreateByOpenIDIdentifier(TestCaseWithFactory):
other_person = self.factory.makePerson('a@xxxxx')
person, db_updated = self.callGetOrCreate(
- u'other-openid-identifier', 'a@xxxxx')
+ 'other-openid-identifier', 'a@xxxxx')
self.assertEqual(other_person, person)
self.assertIn(
- u'other-openid-identifier',
+ 'other-openid-identifier',
[identifier.identifier for identifier in removeSecurityProxy(
person.account).openid_identifiers])
@@ -695,7 +695,7 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonSetGetOrCreateSoftwareCenterCustomer, self).setUp()
+ super().setUp()
self.sca = getUtility(IPersonSet).getByName('software-center-agent')
def test_restricted_to_sca(self):
@@ -703,7 +703,7 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory):
# privileged method.
def do_it():
return getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer(
- getUtility(ILaunchBag).user, u'somebody',
+ getUtility(ILaunchBag).user, 'somebody',
'somebody@xxxxxxxxxxx', 'Example')
random = self.factory.makePerson()
admin = self.factory.makePerson(
@@ -724,10 +724,10 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory):
def test_finds_by_openid(self):
# A Person with the requested OpenID identifier is returned.
somebody = self.factory.makePerson()
- make_openid_identifier(somebody.account, u'somebody')
+ make_openid_identifier(somebody.account, 'somebody')
with person_logged_in(self.sca):
got = getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer(
- self.sca, u'somebody', 'somebody@xxxxxxxxxxx', 'Example')
+ self.sca, 'somebody', 'somebody@xxxxxxxxxxx', 'Example')
self.assertEqual(somebody, got)
# The email address doesn't get linked, as that could change how
@@ -741,7 +741,7 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory):
# provided, a new account is created and returned.
with person_logged_in(self.sca):
made = getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer(
- self.sca, u'somebody', 'somebody@xxxxxxxxxxx', 'Example')
+ self.sca, 'somebody', 'somebody@xxxxxxxxxxx', 'Example')
with admin_logged_in():
self.assertEqual('Example', made.displayname)
self.assertEqual('somebody@xxxxxxxxxxx', made.preferredemail.email)
@@ -757,11 +757,11 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory):
somebody = self.factory.makePerson(
email='existing@xxxxxxxxxxx',
account_status=AccountStatus.NOACCOUNT)
- make_openid_identifier(somebody.account, u'somebody')
+ make_openid_identifier(somebody.account, 'somebody')
self.assertEqual(AccountStatus.NOACCOUNT, somebody.account.status)
with person_logged_in(self.sca):
got = getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer(
- self.sca, u'somebody', 'somebody@xxxxxxxxxxx', 'Example')
+ self.sca, 'somebody', 'somebody@xxxxxxxxxxx', 'Example')
self.assertEqual(somebody, got)
with admin_logged_in():
self.assertEqual(AccountStatus.ACTIVE, somebody.account.status)
@@ -781,7 +781,7 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory):
self.assertRaises(
EmailAddressAlreadyTaken,
getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer,
- self.sca, u'somebody', 'other@xxxxxxxxxxx', 'Example')
+ self.sca, 'somebody', 'other@xxxxxxxxxxx', 'Example')
# The email address stays with the old owner.
email = getUtility(IEmailAddressSet).getByEmail('other@xxxxxxxxxxx')
@@ -790,7 +790,7 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory):
def test_fails_if_account_is_suspended(self):
# Suspended accounts cannot be returned.
somebody = self.factory.makePerson()
- make_openid_identifier(somebody.account, u'somebody')
+ make_openid_identifier(somebody.account, 'somebody')
with admin_logged_in():
somebody.setAccountStatus(
AccountStatus.SUSPENDED, None, "Go away!")
@@ -798,14 +798,14 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory):
self.assertRaises(
AccountSuspendedError,
getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer,
- self.sca, u'somebody', 'somebody@xxxxxxxxxxx', 'Example')
+ self.sca, 'somebody', 'somebody@xxxxxxxxxxx', 'Example')
def test_fails_if_account_is_deactivated(self):
# We don't want to reactivate explicitly deactivated accounts,
# nor do we want to potentially compromise them with a bad email
# address.
somebody = self.factory.makePerson()
- make_openid_identifier(somebody.account, u'somebody')
+ make_openid_identifier(somebody.account, 'somebody')
with admin_logged_in():
somebody.setAccountStatus(
AccountStatus.DEACTIVATED, None, "Goodbye cruel world.")
@@ -813,19 +813,19 @@ class TestPersonSetGetOrCreateSoftwareCenterCustomer(TestCaseWithFactory):
self.assertRaises(
NameAlreadyTaken,
getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer,
- self.sca, u'somebody', 'somebody@xxxxxxxxxxx', 'Example')
+ self.sca, 'somebody', 'somebody@xxxxxxxxxxx', 'Example')
def test_fails_if_account_is_deceased(self):
# Accounts belonging to deceased users cannot be returned.
somebody = self.factory.makePerson()
- make_openid_identifier(somebody.account, u'somebody')
+ make_openid_identifier(somebody.account, 'somebody')
with admin_logged_in():
somebody.setAccountStatus(AccountStatus.DECEASED, None, "RIP")
with person_logged_in(self.sca):
self.assertRaises(
AccountDeceasedError,
getUtility(IPersonSet).getOrCreateSoftwareCenterCustomer,
- self.sca, u'somebody', 'somebody@xxxxxxxxxxx', 'Example')
+ self.sca, 'somebody', 'somebody@xxxxxxxxxxx', 'Example')
class TestPersonGetUsernameForSSO(TestCaseWithFactory):
@@ -833,21 +833,21 @@ class TestPersonGetUsernameForSSO(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonGetUsernameForSSO, self).setUp()
- self.sso = getUtility(IPersonSet).getByName(u'ubuntu-sso')
+ super().setUp()
+ self.sso = getUtility(IPersonSet).getByName('ubuntu-sso')
def test_restricted_to_sca(self):
# Only the ubuntu-sso celebrity can invoke this
# privileged method.
target = self.factory.makePerson(name='username')
- make_openid_identifier(target.account, u'openid')
+ make_openid_identifier(target.account, 'openid')
def do_it():
return getUtility(IPersonSet).getUsernameForSSO(
- getUtility(ILaunchBag).user, u'openid')
+ getUtility(ILaunchBag).user, 'openid')
random = self.factory.makePerson()
admin = self.factory.makePerson(
- member_of=[getUtility(IPersonSet).getByName(u'admins')])
+ member_of=[getUtility(IPersonSet).getByName('admins')])
# Anonymous, random or admin users can't invoke the method.
with anonymous_logged_in():
@@ -866,18 +866,18 @@ class TestPersonSetUsernameFromSSO(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonSetUsernameFromSSO, self).setUp()
- self.sso = getUtility(IPersonSet).getByName(u'ubuntu-sso')
+ super().setUp()
+ self.sso = getUtility(IPersonSet).getByName('ubuntu-sso')
def test_restricted_to_sca(self):
# Only the ubuntu-sso celebrity can invoke this
# privileged method.
def do_it():
getUtility(IPersonSet).setUsernameFromSSO(
- getUtility(ILaunchBag).user, u'openid', u'username')
+ getUtility(ILaunchBag).user, 'openid', 'username')
random = self.factory.makePerson()
admin = self.factory.makePerson(
- member_of=[getUtility(IPersonSet).getByName(u'admins')])
+ member_of=[getUtility(IPersonSet).getByName('admins')])
# Anonymous, random or admin users can't invoke the method.
with anonymous_logged_in():
@@ -896,14 +896,14 @@ class TestPersonSetUsernameFromSSO(TestCaseWithFactory):
# returned.
with person_logged_in(self.sso):
getUtility(IPersonSet).setUsernameFromSSO(
- self.sso, u'openid', u'username')
- person = getUtility(IPersonSet).getByName(u'username')
- self.assertEqual(u'username', person.name)
- self.assertEqual(u'username', person.displayname)
+ self.sso, 'openid', 'username')
+ person = getUtility(IPersonSet).getByName('username')
+ self.assertEqual('username', person.name)
+ self.assertEqual('username', person.displayname)
self.assertEqual(AccountStatus.PLACEHOLDER, person.account.status)
with admin_logged_in():
self.assertContentEqual(
- [u'openid'],
+ ['openid'],
[oid.identifier for oid in person.account.openid_identifiers])
self.assertContentEqual([], person.validatedemails)
self.assertContentEqual([], person.guessedemails)
@@ -911,25 +911,25 @@ class TestPersonSetUsernameFromSSO(TestCaseWithFactory):
def test_creates_new_placeholder_dry_run(self):
with person_logged_in(self.sso):
getUtility(IPersonSet).setUsernameFromSSO(
- self.sso, u'openid', u'username', dry_run=True)
+ self.sso, 'openid', 'username', dry_run=True)
self.assertRaises(
LookupError,
- getUtility(IAccountSet).getByOpenIDIdentifier, u'openid')
- self.assertIs(None, getUtility(IPersonSet).getByName(u'username'))
+ getUtility(IAccountSet).getByOpenIDIdentifier, 'openid')
+ self.assertIs(None, getUtility(IPersonSet).getByName('username'))
def test_updates_existing_placeholder(self):
# An existing placeholder Person with the request OpenID
# identifier has its name updated.
getUtility(IPersonSet).setUsernameFromSSO(
- self.sso, u'openid', u'username')
- person = getUtility(IPersonSet).getByName(u'username')
+ self.sso, 'openid', 'username')
+ person = getUtility(IPersonSet).getByName('username')
# Another call for the same OpenID identifier updates the
# existing Person.
getUtility(IPersonSet).setUsernameFromSSO(
- self.sso, u'openid', u'newsername')
- self.assertEqual(u'newsername', person.name)
- self.assertEqual(u'newsername', person.displayname)
+ self.sso, 'openid', 'newsername')
+ self.assertEqual('newsername', person.name)
+ self.assertEqual('newsername', person.displayname)
self.assertEqual(AccountStatus.PLACEHOLDER, person.account.status)
with admin_logged_in():
self.assertContentEqual([], person.validatedemails)
@@ -937,19 +937,19 @@ class TestPersonSetUsernameFromSSO(TestCaseWithFactory):
def test_updates_existing_placeholder_dry_run(self):
getUtility(IPersonSet).setUsernameFromSSO(
- self.sso, u'openid', u'username')
- person = getUtility(IPersonSet).getByName(u'username')
+ self.sso, 'openid', 'username')
+ person = getUtility(IPersonSet).getByName('username')
getUtility(IPersonSet).setUsernameFromSSO(
- self.sso, u'openid', u'newsername', dry_run=True)
- self.assertEqual(u'username', person.name)
+ self.sso, 'openid', 'newsername', dry_run=True)
+ self.assertEqual('username', person.name)
def test_validation(self, dry_run=False):
# An invalid username is rejected with an InvalidName exception.
self.assertRaises(
InvalidName,
getUtility(IPersonSet).setUsernameFromSSO,
- self.sso, u'openid', u'username!!', dry_run=dry_run)
+ self.sso, 'openid', 'username!!', dry_run=dry_run)
transaction.abort()
# A username that's already in use is rejected with a
@@ -958,17 +958,17 @@ class TestPersonSetUsernameFromSSO(TestCaseWithFactory):
self.assertRaises(
NameAlreadyTaken,
getUtility(IPersonSet).setUsernameFromSSO,
- self.sso, u'openid', u'taken', dry_run=dry_run)
+ self.sso, 'openid', 'taken', dry_run=dry_run)
transaction.abort()
# setUsernameFromSSO can't be used to set an OpenID
# identifier's username if a non-placeholder account exists.
somebody = self.factory.makePerson()
- make_openid_identifier(somebody.account, u'openid-taken')
+ make_openid_identifier(somebody.account, 'openid-taken')
self.assertRaises(
NotPlaceholderAccount,
getUtility(IPersonSet).setUsernameFromSSO,
- self.sso, u'openid-taken', u'username', dry_run=dry_run)
+ self.sso, 'openid-taken', 'username', dry_run=dry_run)
def test_validation_dry_run(self):
self.test_validation(dry_run=True)
@@ -979,21 +979,21 @@ class TestPersonGetSSHKeysForSSO(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonGetSSHKeysForSSO, self).setUp()
- self.sso = getUtility(IPersonSet).getByName(u'ubuntu-sso')
+ super().setUp()
+ self.sso = getUtility(IPersonSet).getByName('ubuntu-sso')
def test_restricted_to_sso(self):
# Only the ubuntu-sso celebrity can invoke this
# privileged method.
target = self.factory.makePerson(name='username')
- make_openid_identifier(target.account, u'openid')
+ make_openid_identifier(target.account, 'openid')
def do_it():
return getUtility(IPersonSet).getUsernameForSSO(
- getUtility(ILaunchBag).user, u'openid')
+ getUtility(ILaunchBag).user, 'openid')
random = self.factory.makePerson()
admin = self.factory.makePerson(
- member_of=[getUtility(IPersonSet).getByName(u'admins')])
+ member_of=[getUtility(IPersonSet).getByName('admins')])
# Anonymous, random or admin users can't invoke the method.
with anonymous_logged_in():
@@ -1011,22 +1011,22 @@ class TestPersonAddSSHKeyFromSSO(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonAddSSHKeyFromSSO, self).setUp()
- self.sso = getUtility(IPersonSet).getByName(u'ubuntu-sso')
+ super().setUp()
+ self.sso = getUtility(IPersonSet).getByName('ubuntu-sso')
def test_restricted_to_sso(self):
# Only the ubuntu-sso celebrity can invoke this
# privileged method.
key_text = self.factory.makeSSHKeyText()
target = self.factory.makePerson(name='username')
- make_openid_identifier(target.account, u'openid')
+ make_openid_identifier(target.account, 'openid')
def do_it():
return getUtility(IPersonSet).addSSHKeyFromSSO(
- getUtility(ILaunchBag).user, u'openid', key_text, False)
+ getUtility(ILaunchBag).user, 'openid', key_text, False)
random = self.factory.makePerson()
admin = self.factory.makePerson(
- member_of=[getUtility(IPersonSet).getByName(u'admins')])
+ member_of=[getUtility(IPersonSet).getByName('admins')])
# Anonymous, random or admin users can't invoke the method.
with anonymous_logged_in():
@@ -1042,11 +1042,11 @@ class TestPersonAddSSHKeyFromSSO(TestCaseWithFactory):
full_key = self.factory.makeSSHKeyText()
_, keytext, comment = full_key.split(' ', 2)
target = self.factory.makePerson(name='username')
- make_openid_identifier(target.account, u'openid')
+ make_openid_identifier(target.account, 'openid')
with person_logged_in(self.sso):
getUtility(IPersonSet).addSSHKeyFromSSO(
- self.sso, u'openid', full_key, False)
+ self.sso, 'openid', full_key, False)
with person_logged_in(target):
[key] = target.sshkeys
@@ -1057,11 +1057,11 @@ class TestPersonAddSSHKeyFromSSO(TestCaseWithFactory):
def test_does_not_add_new_ssh_key_with_dry_run(self):
key_text = self.factory.makeSSHKeyText()
target = self.factory.makePerson(name='username')
- make_openid_identifier(target.account, u'openid')
+ make_openid_identifier(target.account, 'openid')
with person_logged_in(self.sso):
getUtility(IPersonSet).addSSHKeyFromSSO(
- self.sso, u'openid', key_text, True)
+ self.sso, 'openid', key_text, True)
with person_logged_in(target):
self.assertEqual(0, target.sshkeys.count())
@@ -1071,7 +1071,7 @@ class TestPersonAddSSHKeyFromSSO(TestCaseWithFactory):
self.assertRaises(
NoSuchAccount,
getUtility(IPersonSet).addSSHKeyFromSSO,
- self.sso, u'doesnotexist', 'ssh-rsa key comment', True)
+ self.sso, 'doesnotexist', 'ssh-rsa key comment', True)
class TestPersonDeleteSSHKeyFromSSO(TestCaseWithFactory):
@@ -1079,8 +1079,8 @@ class TestPersonDeleteSSHKeyFromSSO(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPersonDeleteSSHKeyFromSSO, self).setUp()
- self.sso = getUtility(IPersonSet).getByName(u'ubuntu-sso')
+ super().setUp()
+ self.sso = getUtility(IPersonSet).getByName('ubuntu-sso')
def test_restricted_to_sso(self):
# Only the ubuntu-sso celebrity can invoke this
@@ -1089,14 +1089,14 @@ class TestPersonDeleteSSHKeyFromSSO(TestCaseWithFactory):
with person_logged_in(target):
key = self.factory.makeSSHKey(target)
key_text = key.getFullKeyText()
- make_openid_identifier(target.account, u'openid')
+ make_openid_identifier(target.account, 'openid')
def do_it():
return getUtility(IPersonSet).deleteSSHKeyFromSSO(
- getUtility(ILaunchBag).user, u'openid', key_text, False)
+ getUtility(ILaunchBag).user, 'openid', key_text, False)
random = self.factory.makePerson()
admin = self.factory.makePerson(
- member_of=[getUtility(IPersonSet).getByName(u'admins')])
+ member_of=[getUtility(IPersonSet).getByName('admins')])
# Anonymous, random or admin users can't invoke the method.
with anonymous_logged_in():
@@ -1112,11 +1112,11 @@ class TestPersonDeleteSSHKeyFromSSO(TestCaseWithFactory):
target = self.factory.makePerson(name='username')
with person_logged_in(target):
key = self.factory.makeSSHKey(target)
- make_openid_identifier(target.account, u'openid')
+ make_openid_identifier(target.account, 'openid')
with person_logged_in(self.sso):
getUtility(IPersonSet).deleteSSHKeyFromSSO(
- self.sso, u'openid', key.getFullKeyText(), False)
+ self.sso, 'openid', key.getFullKeyText(), False)
with person_logged_in(target):
self.assertEqual(0, target.sshkeys.count())
@@ -1125,11 +1125,11 @@ class TestPersonDeleteSSHKeyFromSSO(TestCaseWithFactory):
target = self.factory.makePerson(name='username')
with person_logged_in(target):
key = self.factory.makeSSHKey(target)
- make_openid_identifier(target.account, u'openid')
+ make_openid_identifier(target.account, 'openid')
with person_logged_in(self.sso):
getUtility(IPersonSet).deleteSSHKeyFromSSO(
- self.sso, u'openid', key.getFullKeyText(), True)
+ self.sso, 'openid', key.getFullKeyText(), True)
with person_logged_in(target):
self.assertEqual([key], list(target.sshkeys))
@@ -1139,16 +1139,16 @@ class TestPersonDeleteSSHKeyFromSSO(TestCaseWithFactory):
self.assertRaises(
NoSuchAccount,
getUtility(IPersonSet).deleteSSHKeyFromSSO,
- self.sso, u'doesnotexist', 'ssh-rsa key comment', False)
+ self.sso, 'doesnotexist', 'ssh-rsa key comment', False)
def test_raises_with_bad_key_type(self):
target = self.factory.makePerson(name='username')
- make_openid_identifier(target.account, u'openid')
+ make_openid_identifier(target.account, 'openid')
with person_logged_in(self.sso):
self.assertRaises(
SSHKeyAdditionError,
getUtility(IPersonSet).deleteSSHKeyFromSSO,
- self.sso, u'openid', 'badtype key comment', False)
+ self.sso, 'openid', 'badtype key comment', False)
class TestGDPRUserRetrieval(TestCaseWithFactory):
@@ -1156,7 +1156,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(TestGDPRUserRetrieval, self).setUp()
+ super().setUp()
self.person_set = getUtility(IPersonSet)
self.user = self.factory.makePerson()
self.factory.makeGPGKey(self.user)
@@ -1189,13 +1189,13 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
def test_no_data(self):
with admin_logged_in():
- result = self.person_set.getUserData(u"no@xxxxxxxxxxx")
+ result = self.person_set.getUserData("no@xxxxxxxxxxx")
self.assertDictEqual({"status": "no data held"}, result)
def test_account_data(self):
person = self.factory.makePerson(email="test@xxxxxxxxxxx")
with admin_logged_in():
- result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ result = self.person_set.getUserData("test@xxxxxxxxxxx")
self.assertDictEqual({
"status": "account only; no other data",
"person": canonical_url(person)},
@@ -1206,7 +1206,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
with person_logged_in(person):
person.hide_email_addresses = True
with admin_logged_in():
- result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ result = self.person_set.getUserData("test@xxxxxxxxxxx")
self.assertDictEqual({
"status": "account only; no other data",
"person": canonical_url(person)},
@@ -1219,7 +1219,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
person,
email_status=EmailAddressStatus.NEW)
with admin_logged_in():
- result = self.person_set.getUserData(u"new@xxxxxxxxxxx")
+ result = self.person_set.getUserData("new@xxxxxxxxxxx")
self.assertDictEqual({
"status": "account only; no other data",
"person": canonical_url(person)},
@@ -1229,7 +1229,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
person = self.factory.makePerson(email="test@xxxxxxxxxxx")
self.factory.makeBranch(owner=person)
with admin_logged_in():
- result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ result = self.person_set.getUserData("test@xxxxxxxxxxx")
self.assertThat(result, ContainsDict({
"status": Equals("account with data"),
"person": Equals(canonical_url(person)),
@@ -1241,7 +1241,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
person = self.factory.makePerson(email="test@xxxxxxxxxxx")
self.factory.makeGitRepository(owner=person)
with admin_logged_in():
- result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ result = self.person_set.getUserData("test@xxxxxxxxxxx")
self.assertDictEqual({
"status": "account with data",
"person": canonical_url(person),
@@ -1256,7 +1256,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
other_person = self.factory.makePerson(email="other@xxxxxxxxxxx")
self.factory.makeGitRepository(owner=other_person)
with admin_logged_in():
- result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ result = self.person_set.getUserData("test@xxxxxxxxxxx")
self.assertDictEqual({
"status": "account only; no other data",
"person": canonical_url(person)},
@@ -1266,7 +1266,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
person = self.factory.makePerson(email="test@xxxxxxxxxxx")
self.factory.makeBug(owner=person)
with admin_logged_in():
- result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ result = self.person_set.getUserData("test@xxxxxxxxxxx")
self.assertThat(result, ContainsDict({
"status": Equals("account with data"),
"person": Equals(canonical_url(person)),
@@ -1281,7 +1281,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
person = self.factory.makePerson(email="test@xxxxxxxxxxx")
self.factory.makeBug(owner=person, status=BugTaskStatus.FIXRELEASED)
with admin_logged_in():
- result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ result = self.person_set.getUserData("test@xxxxxxxxxxx")
self.assertThat(result, ContainsDict({
"status": Equals("account with data"),
"person": Equals(canonical_url(person)),
@@ -1294,7 +1294,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
person = self.factory.makePerson(email="test@xxxxxxxxxxx")
self.factory.makeSpecification(owner=person)
with admin_logged_in():
- result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ result = self.person_set.getUserData("test@xxxxxxxxxxx")
self.assertDictEqual({
"status": "account with data",
"person": canonical_url(person),
@@ -1306,7 +1306,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
self.factory.makeSuggestion(translator=person)
self.factory.makeTranslator(person=person)
with admin_logged_in():
- result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ result = self.person_set.getUserData("test@xxxxxxxxxxx")
self.assertThat(result, MatchesDict({
"status": Equals("account with data"),
"person": Equals(canonical_url(person)),
@@ -1320,7 +1320,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
person = self.factory.makePerson(email="test@xxxxxxxxxxx")
self.factory.makeQuestion(owner=person)
with admin_logged_in():
- result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ result = self.person_set.getUserData("test@xxxxxxxxxxx")
self.assertThat(result, ContainsDict({
"status": Equals("account with data"),
"person": Equals(canonical_url(person)),
@@ -1333,7 +1333,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
question = self.factory.makeQuestion(owner=self.factory.makePerson())
with admin_logged_in():
question.addComment(person, "A comment")
- result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ result = self.person_set.getUserData("test@xxxxxxxxxxx")
self.assertThat(result, ContainsDict({
"status": Equals("account with data"),
"person": Equals(canonical_url(person)),
@@ -1346,7 +1346,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
question = self.factory.makeQuestion(owner=person)
with admin_logged_in():
question.setStatus(person, QuestionStatus.SOLVED, "solved!")
- result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ result = self.person_set.getUserData("test@xxxxxxxxxxx")
self.assertThat(result, ContainsDict({
"status": Equals("account with data"),
"person": Equals(canonical_url(person)),
@@ -1358,7 +1358,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
person = self.factory.makePerson(email="test@xxxxxxxxxxx")
with admin_logged_in():
self.factory.makeSSHKey(person)
- result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ result = self.person_set.getUserData("test@xxxxxxxxxxx")
self.assertDictEqual({
"status": "account with data",
"person": canonical_url(person),
@@ -1369,7 +1369,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
person = self.factory.makePerson(email="test@xxxxxxxxxxx")
with admin_logged_in():
self.factory.makeGPGKey(person)
- result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ result = self.person_set.getUserData("test@xxxxxxxxxxx")
self.assertThat(result, ContainsDict({
"status": Equals("account with data"),
"person": Equals(canonical_url(person)),
@@ -1381,7 +1381,7 @@ class TestGDPRUserRetrieval(TestCaseWithFactory):
with admin_logged_in():
key = self.factory.makeGPGKey(person)
key.active = False
- result = self.person_set.getUserData(u"test@xxxxxxxxxxx")
+ result = self.person_set.getUserData("test@xxxxxxxxxxx")
self.assertThat(result, ContainsDict({
"status": Equals("account with data"),
"person": Equals(canonical_url(person)),
diff --git a/lib/lp/registry/tests/test_persontransferjob.py b/lib/lp/registry/tests/test_persontransferjob.py
index bc78115..70fab28 100644
--- a/lib/lp/registry/tests/test_persontransferjob.py
+++ b/lib/lp/registry/tests/test_persontransferjob.py
@@ -40,7 +40,7 @@ class PersonTransferJobTestCase(TestCaseWithFactory):
# gets unserialized from JSON, so the representation returned by
# person_transfer_job.metadata will be different from what we
# originally passed in.
- metadata_expected = [u'some', u'arbitrary', u'metadata']
+ metadata_expected = ['some', 'arbitrary', 'metadata']
self.assertEqual(metadata_expected, person_transfer_job.metadata)
diff --git a/lib/lp/registry/tests/test_pillar.py b/lib/lp/registry/tests/test_pillar.py
index 0ff1db2..e4efd3c 100644
--- a/lib/lp/registry/tests/test_pillar.py
+++ b/lib/lp/registry/tests/test_pillar.py
@@ -40,7 +40,7 @@ class TestPillarNameSet(TestCaseWithFactory):
pillar.name for pillar in
pillar_set.search(
getUtility(IPersonSet).getByName('mark'), 'lz', limit=5)]
- self.assertEqual(result_names, [u'launchzap', u'lz-bar', u'lz-foo'])
+ self.assertEqual(result_names, ['launchzap', 'lz-bar', 'lz-foo'])
def test_search_percent(self):
"""Searches involving '%' characters work correctly."""
@@ -52,7 +52,7 @@ class TestPillarNameSet(TestCaseWithFactory):
result_names = [
pillar.name
for pillar in pillar_set.search(mark, '% character', limit=5)]
- self.assertEqual([u'percent'], result_names)
+ self.assertEqual(['percent'], result_names)
class TestPillarPerson(TestCaseWithFactory):
diff --git a/lib/lp/registry/tests/test_pillar_vocabularies.py b/lib/lp/registry/tests/test_pillar_vocabularies.py
index 08ada9d..d2288eb 100644
--- a/lib/lp/registry/tests/test_pillar_vocabularies.py
+++ b/lib/lp/registry/tests/test_pillar_vocabularies.py
@@ -23,7 +23,7 @@ class TestPillarVocabularyBase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPillarVocabularyBase, self).setUp()
+ super().setUp()
self.vocabulary = PillarVocabularyBase()
self.product = self.factory.makeProduct(name='orchid-snark')
self.distribution = self.factory.makeDistribution(name='zebra-snark')
@@ -98,7 +98,7 @@ class TestDistributionOrProductVocabulary(TestCaseWithFactory,
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistributionOrProductVocabulary, self).setUp()
+ super().setUp()
self.vocabulary = DistributionOrProductVocabulary()
self.product = self.factory.makeProduct(name='orchid-snark')
self.distribution = self.factory.makeDistribution(name='zebra-snark')
@@ -143,7 +143,7 @@ class TestDistributionOrProductOrProjectGroupVocabulary(TestCaseWithFactory,
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistributionOrProductOrProjectGroupVocabulary, self).setUp()
+ super().setUp()
self.vocabulary = DistributionOrProductOrProjectGroupVocabulary()
self.product = self.factory.makeProduct(name='orchid-snark')
self.distribution = self.factory.makeDistribution(name='zebra-snark')
diff --git a/lib/lp/registry/tests/test_poll.py b/lib/lp/registry/tests/test_poll.py
index ebd2dde..6d940a4 100644
--- a/lib/lp/registry/tests/test_poll.py
+++ b/lib/lp/registry/tests/test_poll.py
@@ -54,7 +54,7 @@ class TestPoll(TestCaseWithFactory):
class MatchesPollAPI(ContainsDict):
def __init__(self, webservice, poll):
- super(MatchesPollAPI, self).__init__({
+ super().__init__({
"team_link": Equals(webservice.getAbsoluteUrl(api_url(poll.team))),
"name": Equals(poll.name),
"title": Equals(poll.title),
@@ -71,7 +71,7 @@ class TestPollWebservice(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(TestPollWebservice, self).setUp()
+ super().setUp()
self.person = self.factory.makePerson()
self.pushConfig("launchpad", default_batch_size=50)
diff --git a/lib/lp/registry/tests/test_prf_finder.py b/lib/lp/registry/tests/test_prf_finder.py
index 7b4c024..983f16e 100644
--- a/lib/lp/registry/tests/test_prf_finder.py
+++ b/lib/lp/registry/tests/test_prf_finder.py
@@ -151,7 +151,7 @@ class GetFiltersTestCase(TestCaseWithFactory):
class HandleProductTestCase(TestCase):
def setUp(self):
- super(HandleProductTestCase, self).setUp()
+ super().setUp()
# path for release tree
self.release_root = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, self.release_root, ignore_errors=True)
@@ -235,7 +235,7 @@ class HandleReleaseTestCase(TestCase):
return url
def setUp(self):
- super(HandleReleaseTestCase, self).setUp()
+ super().setUp()
switch_dbuser(config.productreleasefinder.dbuser)
self.release_root = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, self.release_root, ignore_errors=True)
diff --git a/lib/lp/registry/tests/test_prf_walker.py b/lib/lp/registry/tests/test_prf_walker.py
index 04012e1..c0c88d9 100644
--- a/lib/lp/registry/tests/test_prf_walker.py
+++ b/lib/lp/registry/tests/test_prf_walker.py
@@ -146,7 +146,7 @@ class WalkerBase_walk(TestCase):
def tearDown(self):
reset_logging()
- super(WalkerBase_walk, self).tearDown()
+ super().tearDown()
def test_walk_UnicodeEncodeError(self):
"""Verify that a UnicodeEncodeError is logged."""
@@ -156,7 +156,7 @@ class WalkerBase_walk(TestCase):
def list(self, sub_dir):
# Force the walker to handle an exception.
raise UnicodeEncodeError(
- 'utf-8', u'source text', 0, 1, 'reason')
+ 'utf-8', 'source text', 0, 1, 'reason')
def open(self):
pass
@@ -184,7 +184,7 @@ class WalkerBase_walk(TestCase):
pass
def open(self):
- raise IOError("Test failure.")
+ raise OSError("Test failure.")
def close(self):
pass
@@ -254,7 +254,7 @@ class HTTPWalker_Base(TestCase):
class HTTPWalker_ListDir(TestCase):
def setUp(self):
- super(HTTPWalker_ListDir, self).setUp()
+ super().setUp()
self.addCleanup(reset_logging)
original_timeout_function = get_default_timeout_function()
set_default_timeout_function(lambda: 60.0)
@@ -443,7 +443,7 @@ class HTTPWalker_IsDirectory(TestCase):
def tearDown(self):
reset_logging()
- super(HTTPWalker_IsDirectory, self).tearDown()
+ super().tearDown()
def testFtpIsDirectory(self):
# Test that no requests are made by isDirectory() when walking
diff --git a/lib/lp/registry/tests/test_private_team_visibility.py b/lib/lp/registry/tests/test_private_team_visibility.py
index 524963f..6f935a6 100644
--- a/lib/lp/registry/tests/test_private_team_visibility.py
+++ b/lib/lp/registry/tests/test_private_team_visibility.py
@@ -50,7 +50,7 @@ class TestPrivateTeamVisibility(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestPrivateTeamVisibility, self).setUp()
+ super().setUp()
self.priv_owner = self.factory.makePerson(name="priv-owner")
self.priv_member = self.factory.makePerson(name="priv-member")
self.priv_team = self.factory.makeTeam(
diff --git a/lib/lp/registry/tests/test_product.py b/lib/lp/registry/tests/test_product.py
index 656f7ec..d0eb5a6 100644
--- a/lib/lp/registry/tests/test_product.py
+++ b/lib/lp/registry/tests/test_product.py
@@ -272,7 +272,7 @@ class TestProduct(TestCaseWithFactory):
for name in ('1', '2', '3', '3a', '3b', 'alpha', 'beta'):
self.factory.makeProductSeries(product=product, name=name)
self.assertEqual(
- [u'trunk', u'3b', u'3a', u'3', u'2', u'1', u'beta', u'alpha'],
+ ['trunk', '3b', '3a', '3', '2', '1', 'beta', 'alpha'],
[series.name for series in product.getVersionSortedSeries()])
def test_getVersionSortedSeries_with_specific_statuses(self):
@@ -289,7 +289,7 @@ class TestProduct(TestCaseWithFactory):
active_series = product.getVersionSortedSeries(
statuses=[SeriesStatus.OBSOLETE])
self.assertEqual(
- [u'trunk', u'obsolete-series'],
+ ['trunk', 'obsolete-series'],
[series.name for series in active_series])
def test_getVersionSortedSeries_without_specific_statuses(self):
@@ -306,7 +306,7 @@ class TestProduct(TestCaseWithFactory):
active_series = product.getVersionSortedSeries(
filter_statuses=[SeriesStatus.OBSOLETE])
self.assertEqual(
- [u'trunk', u'active-series'],
+ ['trunk', 'active-series'],
[series.name for series in active_series])
def test_inferred_vcs(self):
@@ -1417,7 +1417,7 @@ class TestProductFiles(TestCase):
def test_adddownloadfile_nonascii_filename(self):
"""Test uploading a file with a non-ascii char in the filename."""
firefox_owner = setupBrowser(auth='Basic mark@xxxxxxxxxxx:test')
- filename = u'foo\xa5.txt'
+ filename = 'foo\xa5.txt'
firefox_owner.open(
'http://launchpad.test/firefox/1.0/1.0.0/+adddownloadfile')
foo_file = BytesIO(b'Foo installer package...')
@@ -1432,7 +1432,7 @@ class TestProductFiles(TestCase):
firefox_owner.getControl("Upload").click()
self.assertEqual(
get_feedback_messages(firefox_owner.contents),
- [u"Your file 'foo\xa5.txt' has been uploaded."])
+ ["Your file 'foo\xa5.txt' has been uploaded."])
firefox_owner.open('http://launchpad.test/firefox/+download')
content = find_main_content(firefox_owner.contents)
rows = content.find_all('tr')
@@ -1443,21 +1443,21 @@ class TestProductFiles(TestCase):
self.assertEqual(
a_element['href'],
'http://launchpad.test/firefox/1.0/1.0.0/+download/foo%C2%A5.txt')
- self.assertEqual(a_element.contents[0].strip(), u'foo\xa5.txt')
+ self.assertEqual(a_element.contents[0].strip(), 'foo\xa5.txt')
# 2nd row
a_element = a_list[1]
self.assertEqual(
a_element['href'],
'http://launchpad.test/firefox/1.0/1.0.0/+download/'
'foo%C2%A5.txt/+md5')
- self.assertEqual(a_element.contents[0].strip(), u'md5')
+ self.assertEqual(a_element.contents[0].strip(), 'md5')
# 3rd row
a_element = a_list[2]
self.assertEqual(
a_element['href'],
'http://launchpad.test/firefox/1.0/1.0.0/+download/'
'foo%C2%A5.txt.asc')
- self.assertEqual(a_element.contents[0].strip(), u'sig')
+ self.assertEqual(a_element.contents[0].strip(), 'sig')
class ProductAttributeCacheTestCase(TestCaseWithFactory):
@@ -1466,7 +1466,7 @@ class ProductAttributeCacheTestCase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(ProductAttributeCacheTestCase, self).setUp()
+ super().setUp()
self.product = Product.selectOneBy(name='tomcat')
def testLicensesCache(self):
@@ -1580,7 +1580,7 @@ class ProductLicensingTestCase(TestCaseWithFactory):
product = self.factory.makeProduct()
self.factory.makeCommercialSubscription(product)
with celebrity_logged_in('admin'):
- product.commercial_subscription.sales_system_id = u'testing'
+ product.commercial_subscription.sales_system_id = 'testing'
date_expires = product.commercial_subscription.date_expires
with person_logged_in(product.owner):
product.licenses = [License.OTHER_PROPRIETARY]
@@ -1647,7 +1647,7 @@ class BaseSharingPolicyTests:
raise NotImplementedError
def setUp(self):
- super(BaseSharingPolicyTests, self).setUp()
+ super().setUp()
self.product = self.factory.makeProduct()
self.commercial_admin = self.factory.makeCommercialAdmin()
@@ -1880,7 +1880,7 @@ class ProductSnapshotTestCase(TestCaseWithFactory):
layer = ZopelessDatabaseLayer
def setUp(self):
- super(ProductSnapshotTestCase, self).setUp()
+ super().setUp()
self.product = self.factory.makeProduct(name="shamwow")
def test_excluded_from_snapshot(self):
@@ -1925,7 +1925,7 @@ class TestSpecifications(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestSpecifications, self).setUp()
+ super().setUp()
self.date_created = datetime.now(pytz.utc)
def makeSpec(self, product=None, date_created=0, title=None,
@@ -2074,9 +2074,9 @@ class TestSpecifications(TestCaseWithFactory):
blueprint1 = self.makeSpec(title='abc')
product = blueprint1.product
blueprint2 = self.makeSpec(product, title='def')
- result = list_result(product, [u'abc'])
+ result = list_result(product, ['abc'])
self.assertEqual([blueprint1], result)
- result = list_result(product, [u'def'])
+ result = list_result(product, ['def'])
self.assertEqual([blueprint2], result)
def test_proprietary_not_listed(self):
@@ -2143,7 +2143,7 @@ class TestWebService(WebServiceTestCase):
# The product layer provides the context restriction, so we need to
# check we can access context filtered references - e.g. on question.
oopsid = "OOPS-abcdef1234"
- question = self.factory.makeQuestion(title=u"Crash with %s" % oopsid)
+ question = self.factory.makeQuestion(title="Crash with %s" % oopsid)
product = question.product
transaction.commit()
ws_product = self.wsObject(product, product.owner)
@@ -2161,7 +2161,7 @@ class TestWebService(WebServiceTestCase):
# The product layer provides the context restriction, so we need to
# check the filter is tight enough - other contexts should not work.
oopsid = "OOPS-abcdef1234"
- self.factory.makeQuestion(title=u"Crash with %s" % oopsid)
+ self.factory.makeQuestion(title="Crash with %s" % oopsid)
product = self.factory.makeProduct()
transaction.commit()
ws_product = self.wsObject(product, product.owner)
diff --git a/lib/lp/registry/tests/test_product_vocabularies.py b/lib/lp/registry/tests/test_product_vocabularies.py
index 83a3e9c..0261b64 100644
--- a/lib/lp/registry/tests/test_product_vocabularies.py
+++ b/lib/lp/registry/tests/test_product_vocabularies.py
@@ -23,7 +23,7 @@ class TestProductVocabulary(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestProductVocabulary, self).setUp()
+ super().setUp()
self.vocabulary = ProductVocabulary()
self.product = self.factory.makeProduct(
name='bedbugs', displayname='BedBugs')
diff --git a/lib/lp/registry/tests/test_productrelease.py b/lib/lp/registry/tests/test_productrelease.py
index 8a837da..39c8222 100644
--- a/lib/lp/registry/tests/test_productrelease.py
+++ b/lib/lp/registry/tests/test_productrelease.py
@@ -30,7 +30,7 @@ class ProductReleaseSetTestcase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(ProductReleaseSetTestcase, self).setUp()
+ super().setUp()
self.product_release_set = getUtility(IProductReleaseSet)
def test_getBySeriesAndVersion_match(self):
diff --git a/lib/lp/registry/tests/test_productseries.py b/lib/lp/registry/tests/test_productseries.py
index 52fdbcc..da6f828 100644
--- a/lib/lp/registry/tests/test_productseries.py
+++ b/lib/lp/registry/tests/test_productseries.py
@@ -445,7 +445,7 @@ class TestProductSeriesSet(TestCaseWithFactory):
layer = ZopelessDatabaseLayer
def setUp(self):
- super(TestProductSeriesSet, self).setUp()
+ super().setUp()
self.ps_set = getUtility(IProductSeriesSet)
def _makeSeriesAndBranch(self, import_mode, branch=None, link_branch=True):
@@ -532,7 +532,7 @@ class TestProductSeriesReleases(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestProductSeriesReleases, self).setUp()
+ super().setUp()
self.product = self.factory.makeProduct()
self.productseries = self.factory.makeProductSeries(
product=self.product)
@@ -585,7 +585,7 @@ class ProductSeriesSecurityAdaperTestCase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(ProductSeriesSecurityAdaperTestCase, self).setUp()
+ super().setUp()
self.public_product = self.factory.makeProduct()
self.public_series = self.factory.makeProductSeries(
product=self.public_product)
diff --git a/lib/lp/registry/tests/test_productseries_vocabularies.py b/lib/lp/registry/tests/test_productseries_vocabularies.py
index 88121d8..4010dc5 100644
--- a/lib/lp/registry/tests/test_productseries_vocabularies.py
+++ b/lib/lp/registry/tests/test_productseries_vocabularies.py
@@ -19,7 +19,7 @@ class TestProductSeriesVocabulary(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestProductSeriesVocabulary, self).setUp()
+ super().setUp()
self.vocabulary = ProductSeriesVocabulary()
self.product_prefix = 'asdf987-'
self.series1_prefix = 'qwerty-'
diff --git a/lib/lp/registry/tests/test_project_milestone.py b/lib/lp/registry/tests/test_project_milestone.py
index 5caa8f7..9b4f767 100644
--- a/lib/lp/registry/tests/test_project_milestone.py
+++ b/lib/lp/registry/tests/test_project_milestone.py
@@ -103,18 +103,18 @@ class ProjectMilestoneTest(unittest.TestCase):
# milestone of the same name.
gnome_milestone_names = [
milestone.name for milestone in gnome.all_milestones]
- self.assertEqual(gnome_milestone_names, [u'2.1.6', u'1.0'])
+ self.assertEqual(gnome_milestone_names, ['2.1.6', '1.0'])
self.createProductMilestone('1.1', 'evolution', None)
gnome_milestone_names = [
milestone.name for milestone in gnome.all_milestones]
- self.assertEqual(gnome_milestone_names, [u'2.1.6', u'1.1', u'1.0'])
+ self.assertEqual(gnome_milestone_names, ['2.1.6', '1.1', '1.0'])
# There is only one project milestone named '1.1', regardless of the
# number of product milestones with this name.
self.createProductMilestone('1.1', 'gnomebaker', None)
gnome_milestone_names = [
milestone.name for milestone in gnome.all_milestones]
- self.assertEqual(gnome_milestone_names, [u'2.1.6', u'1.1', u'1.0'])
+ self.assertEqual(gnome_milestone_names, ['2.1.6', '1.1', '1.0'])
def test_milestone_date_expected(self):
"""The dateexpected attribute.
@@ -170,7 +170,7 @@ class ProjectMilestoneTest(unittest.TestCase):
# ... while project.all_milestones lists inactive milestones too.
self.assertEqual(
[milestone.name for milestone in gnome.all_milestones],
- [u'2.1.6', u'1.1', u'1.0'])
+ ['2.1.6', '1.1', '1.0'])
def test_no_foreign_milestones(self):
"""Milestones in "foreign" products.
@@ -186,7 +186,7 @@ class ProjectMilestoneTest(unittest.TestCase):
gnome = getUtility(IProjectGroupSet)['gnome']
self.assertEqual(
[milestone.name for milestone in gnome.all_milestones],
- [u'2.1.6', u'1.0'])
+ ['2.1.6', '1.0'])
def createSpecification(self, milestone_name, product_name):
"""Create a specification, assigned to a milestone, for a product."""
diff --git a/lib/lp/registry/tests/test_projectgroup.py b/lib/lp/registry/tests/test_projectgroup.py
index abf6460..2f32fba 100644
--- a/lib/lp/registry/tests/test_projectgroup.py
+++ b/lib/lp/registry/tests/test_projectgroup.py
@@ -69,7 +69,7 @@ class ProjectGroupSearchTestCase(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(ProjectGroupSearchTestCase, self).setUp()
+ super().setUp()
self.person = self.factory.makePerson()
self.projectgroup1 = self.factory.makeProject(
name="zazzle", owner=self.person)
@@ -155,7 +155,7 @@ class TestProjectGroupPermissions(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestProjectGroupPermissions, self).setUp()
+ super().setUp()
self.pg = self.factory.makeProject(name='my-project-group')
def test_attribute_changes_by_admin(self):
diff --git a/lib/lp/registry/tests/test_service_usage.py b/lib/lp/registry/tests/test_service_usage.py
index 413eb37..9a4bb2b 100644
--- a/lib/lp/registry/tests/test_service_usage.py
+++ b/lib/lp/registry/tests/test_service_usage.py
@@ -13,7 +13,7 @@ from lp.testing import (
from lp.testing.layers import DatabaseFunctionalLayer
-class UsageEnumsMixin(object):
+class UsageEnumsMixin:
"""Base class for testing the UsageEnums on their pillars."""
def setUp(self):
@@ -114,7 +114,7 @@ class UsageEnumsMixin(object):
self.target.official_blueprints)
-class SeriesUsageEnumsMixin(object):
+class SeriesUsageEnumsMixin:
"""Mixin to test the usage attributes on product and distro series."""
def setUp(self):
@@ -146,7 +146,7 @@ class TestDistributionUsageEnums(TestCaseWithFactory, UsageEnumsMixin):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistributionUsageEnums, self).setUp()
+ super().setUp()
self.target = self.factory.makeDistribution()
def test_codehosting_usage(self):
@@ -163,7 +163,7 @@ class TestProductUsageEnums(TestCaseWithFactory, UsageEnumsMixin):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestProductUsageEnums, self).setUp()
+ super().setUp()
self.target = self.factory.makeProduct()
def test_codehosting_unknown(self):
@@ -220,7 +220,7 @@ class TestProductSeriesUsageEnums(
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestProductSeriesUsageEnums, self).setUp()
+ super().setUp()
self.series_pillar = self.factory.makeProduct()
self.series = self.factory.makeProductSeries(
product=self.series_pillar)
@@ -241,7 +241,7 @@ class TestDistroSeriesUsageEnums(
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDistroSeriesUsageEnums, self).setUp()
+ super().setUp()
self.series_pillar = self.factory.makeDistribution()
self.series = self.factory.makeDistroSeries(
distribution=self.series_pillar)
diff --git a/lib/lp/registry/tests/test_sharingjob.py b/lib/lp/registry/tests/test_sharingjob.py
index 1a96940..d3f0bbb 100644
--- a/lib/lp/registry/tests/test_sharingjob.py
+++ b/lib/lp/registry/tests/test_sharingjob.py
@@ -276,7 +276,7 @@ class RemoveArtifactSubscriptionsJobTestCase(TestCaseWithFactory):
}
features.update(SNAP_TESTING_FLAGS)
self.useFixture(FeatureFixture(features))
- super(RemoveArtifactSubscriptionsJobTestCase, self).setUp()
+ super().setUp()
def test_create(self):
# Create an instance of RemoveArtifactSubscriptionsJob.
diff --git a/lib/lp/registry/tests/test_sourcepackage.py b/lib/lp/registry/tests/test_sourcepackage.py
index 1cafc6f..ca32cff 100644
--- a/lib/lp/registry/tests/test_sourcepackage.py
+++ b/lib/lp/registry/tests/test_sourcepackage.py
@@ -276,9 +276,9 @@ class TestSourcePackage(TestCaseWithFactory):
'mozilla-firefox')
expected_summary = (
- u'mozilla-firefox: Mozilla Firefox Web Browser\n'
- u'mozilla-firefox-data: No summary available for '
- u'mozilla-firefox-data in ubuntu warty.')
+ 'mozilla-firefox: Mozilla Firefox Web Browser\n'
+ 'mozilla-firefox-data: No summary available for '
+ 'mozilla-firefox-data in ubuntu warty.')
self.assertEqual(''.join(expected_summary), sp.summary)
def test_deletePackaging(self):
diff --git a/lib/lp/registry/tests/test_sourcepackagename_vocabulary.py b/lib/lp/registry/tests/test_sourcepackagename_vocabulary.py
index 044b483..3fa73ef 100644
--- a/lib/lp/registry/tests/test_sourcepackagename_vocabulary.py
+++ b/lib/lp/registry/tests/test_sourcepackagename_vocabulary.py
@@ -42,7 +42,7 @@ class TestSourcePackageNameVocabulary(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestSourcePackageNameVocabulary, self).setUp()
+ super().setUp()
self.vocabulary = SourcePackageNameVocabulary()
self.spns = [
self.factory.makeSourcePackageName(name=name)
diff --git a/lib/lp/registry/tests/test_team.py b/lib/lp/registry/tests/test_team.py
index b624147..5ba16a2 100644
--- a/lib/lp/registry/tests/test_team.py
+++ b/lib/lp/registry/tests/test_team.py
@@ -69,7 +69,7 @@ class TestTeamContactAddress(TestCaseWithFactory):
mailing_list.address)
def setUp(self):
- super(TestTeamContactAddress, self).setUp()
+ super().setUp()
self.team = self.factory.makeTeam(name='alpha')
self.address = self.factory.makeEmail('team@xxxxxxxxxxx', self.team)
@@ -153,7 +153,7 @@ class TestTeamGetTeamAdminsEmailAddresses(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestTeamGetTeamAdminsEmailAddresses, self).setUp()
+ super().setUp()
self.team = self.factory.makeTeam(name='finch')
login_celebrity('admin')
@@ -218,7 +218,7 @@ class TestDefaultRenewalPeriodIsRequiredForSomeTeams(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDefaultRenewalPeriodIsRequiredForSomeTeams, self).setUp()
+ super().setUp()
self.team = self.factory.makeTeam()
login_person(self.team.teamowner)
@@ -268,7 +268,7 @@ class TestDefaultMembershipPeriod(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestDefaultMembershipPeriod, self).setUp()
+ super().setUp()
self.team = self.factory.makeTeam()
login_person(self.team.teamowner)
@@ -549,7 +549,7 @@ class TestVisibilityConsistencyWarning(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestVisibilityConsistencyWarning, self).setUp()
+ super().setUp()
self.team = self.factory.makeTeam()
login_celebrity('admin')
diff --git a/lib/lp/registry/tests/test_team_webservice.py b/lib/lp/registry/tests/test_team_webservice.py
index 024b3a3..2275742 100644
--- a/lib/lp/registry/tests/test_team_webservice.py
+++ b/lib/lp/registry/tests/test_team_webservice.py
@@ -108,7 +108,7 @@ class TestTeamLimitedViewAccess(TestCaseWithFactory):
layer = AppServerLayer
def setUp(self):
- super(TestTeamLimitedViewAccess, self).setUp()
+ super().setUp()
# Make a private team.
team_owner = self.factory.makePerson()
diff --git a/lib/lp/registry/tests/test_teammembership.py b/lib/lp/registry/tests/test_teammembership.py
index 520751f..3f3b58b 100644
--- a/lib/lp/registry/tests/test_teammembership.py
+++ b/lib/lp/registry/tests/test_teammembership.py
@@ -131,7 +131,7 @@ class TestTeamMembershipSet(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestTeamMembershipSet, self).setUp()
+ super().setUp()
login('test@xxxxxxxxxxxxx')
self.membershipset = getUtility(ITeamMembershipSet)
self.personset = getUtility(IPersonSet)
@@ -266,7 +266,7 @@ class TeamParticipationTestCase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TeamParticipationTestCase, self).setUp()
+ super().setUp()
login('foo.bar@xxxxxxxxxxxxx')
person_set = getUtility(IPersonSet)
self.foo_bar = person_set.getByEmail('foo.bar@xxxxxxxxxxxxx')
@@ -360,7 +360,7 @@ class TestTeamParticipationHierarchy(TeamParticipationTestCase):
def setUp(self):
"""Setup the team hierarchy."""
- super(TestTeamParticipationHierarchy, self).setUp()
+ super().setUp()
self.team5.addMember(self.no_priv, self.foo_bar)
self.team1.addMember(self.team2, self.foo_bar, force_team_add=True)
self.team2.addMember(self.team3, self.foo_bar, force_team_add=True)
@@ -436,7 +436,7 @@ class TestTeamParticipationTree(TeamParticipationTestCase):
def setUp(self):
"""Setup the team hierarchy."""
- super(TestTeamParticipationTree, self).setUp()
+ super().setUp()
self.team5.addMember(self.no_priv, self.foo_bar)
self.team1.addMember(self.team2, self.foo_bar, force_team_add=True)
self.team2.addMember(self.team3, self.foo_bar, force_team_add=True)
@@ -445,7 +445,7 @@ class TestTeamParticipationTree(TeamParticipationTestCase):
self.team4.addMember(self.team5, self.foo_bar, force_team_add=True)
def tearDown(self):
- super(TestTeamParticipationTree, self).tearDown()
+ super().tearDown()
self.layer.force_dirty_database()
def testTeamParticipationSetUp(self):
@@ -510,7 +510,7 @@ class TestParticipationCleanup(TeamParticipationTestCase):
def setUp(self):
"""Setup the team hierarchy."""
- super(TestParticipationCleanup, self).setUp()
+ super().setUp()
self.team1.addMember(self.team2, self.foo_bar, force_team_add=True)
self.team2.addMember(self.team3, self.foo_bar, force_team_add=True)
self.team3.addMember(self.team4, self.foo_bar, force_team_add=True)
@@ -547,7 +547,7 @@ class TestTeamParticipationMesh(TeamParticipationTestCase):
def setUp(self):
"""Setup the team hierarchy."""
- super(TestTeamParticipationMesh, self).setUp()
+ super().setUp()
self.team6 = getUtility(IPersonSet).newTeam(
self.foo_bar, 'team6', 'team6')
self.team5.addMember(self.no_priv, self.foo_bar)
@@ -560,7 +560,7 @@ class TestTeamParticipationMesh(TeamParticipationTestCase):
self.team6.addMember(self.team4, self.foo_bar, force_team_add=True)
def tearDown(self):
- super(TestTeamParticipationMesh, self).tearDown()
+ super().tearDown()
self.layer.force_dirty_database()
def testTeamParticipationSetUp(self):
@@ -706,7 +706,7 @@ class TestTeamMembershipSetStatus(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestTeamMembershipSetStatus, self).setUp()
+ super().setUp()
login('foo.bar@xxxxxxxxxxxxx')
self.foobar = getUtility(IPersonSet).getByName('name16')
self.no_priv = getUtility(IPersonSet).getByName('no-priv')
@@ -1015,7 +1015,7 @@ class TestTeamMembershipJobs(TestCaseWithFactory):
self.useFixture(FeatureFixture({
'jobs.celery.enabled_classes': 'RemoveArtifactSubscriptionsJob',
}))
- super(TestTeamMembershipJobs, self).setUp()
+ super().setUp()
def _make_subscribed_bug(self, grantee, target,
information_type=InformationType.USERDATA):
@@ -1073,7 +1073,7 @@ class TestTeamMembershipSendExpirationWarningEmail(TestCaseWithFactory):
layer = ZopelessDatabaseLayer
def setUp(self):
- super(TestTeamMembershipSendExpirationWarningEmail, self).setUp()
+ super().setUp()
self.member = self.factory.makePerson(name='green')
self.team = self.factory.makeTeam(name='red')
login_person(self.team.teamowner)
diff --git a/lib/lp/registry/tests/test_teammembership_webservice.py b/lib/lp/registry/tests/test_teammembership_webservice.py
index 6edea51..81a1a09 100644
--- a/lib/lp/registry/tests/test_teammembership_webservice.py
+++ b/lib/lp/registry/tests/test_teammembership_webservice.py
@@ -20,7 +20,7 @@ class TestTeamMembershipTransitions(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestTeamMembershipTransitions, self).setUp()
+ super().setUp()
self.person = self.factory.makePerson(name='some-person')
owner = self.factory.makePerson()
self.team = self.factory.makeTeam(
diff --git a/lib/lp/registry/tests/test_xmlrpc.py b/lib/lp/registry/tests/test_xmlrpc.py
index fccd0bf..140e6b2 100644
--- a/lib/lp/registry/tests/test_xmlrpc.py
+++ b/lib/lp/registry/tests/test_xmlrpc.py
@@ -41,7 +41,7 @@ class TestCanonicalSSOApplication(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestCanonicalSSOApplication, self).setUp()
+ super().setUp()
self.rpc_proxy = xmlrpc.client.ServerProxy(
'http://xmlrpc-private.launchpad.test:8087/canonicalsso',
transport=XMLRPCTestTransport())
@@ -87,7 +87,7 @@ class TestMailingListXMLRPC(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestMailingListXMLRPC, self).setUp()
+ super().setUp()
self.rpc_proxy = xmlrpc.client.ServerProxy(
'http://xmlrpc-private.launchpad.test:8087/mailinglists',
transport=XMLRPCTestTransport())
@@ -146,7 +146,7 @@ class TestMailingListXMLRPCMessage(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(TestMailingListXMLRPCMessage, self).setUp()
+ super().setUp()
self.rpc_proxy = xmlrpc.client.ServerProxy(
'http://xmlrpc-private.launchpad.test:8087/mailinglists',
transport=XMLRPCTestTransport())
diff --git a/lib/lp/registry/vocabularies.py b/lib/lp/registry/vocabularies.py
index d01a9b9..045cb4e 100644
--- a/lib/lp/registry/vocabularies.py
+++ b/lib/lp/registry/vocabularies.py
@@ -491,7 +491,7 @@ class PersonAccountToMergeVocabulary(
def __contains__(self, obj):
return obj in self._select()
- def _select(self, text=u""):
+ def _select(self, text=""):
"""Return `IPerson` objects that match the text."""
return getUtility(IPersonSet).findPerson(
text, exclude_inactive_accounts=False,
@@ -902,7 +902,7 @@ class AllUserTeamsParticipationVocabulary(ValidTeamVocabulary):
displayname = 'Select a Team of which you are a member'
def __init__(self, context):
- super(AllUserTeamsParticipationVocabulary, self).__init__(context)
+ super().__init__(context)
user = getUtility(ILaunchBag).user
if user is None:
self.extra_clause = False
@@ -970,7 +970,7 @@ class NewPillarGranteeVocabulary(ValidPersonOrExclusiveTeamVocabulary):
def __init__(self, context):
assert IPillar.providedBy(context)
- super(NewPillarGranteeVocabulary, self).__init__(context)
+ super().__init__(context)
aps = getUtility(IAccessPolicySource)
access_policies = aps.findByPillar([self.context])
self.policy_ids = [policy.id for policy in access_policies]
@@ -985,7 +985,7 @@ class NewPillarGranteeVocabulary(ValidPersonOrExclusiveTeamVocabulary):
""" % sqlvalues(self.policy_ids))
return And(
clause,
- super(NewPillarGranteeVocabulary, self).extra_clause)
+ super().extra_clause)
@implementer(IHugeVocabulary)
@@ -1081,17 +1081,14 @@ class UserTeamsParticipationPlusSelfVocabulary(
def __iter__(self):
logged_in_user = getUtility(ILaunchBag).user
yield self.toTerm(logged_in_user)
- super_class = super(UserTeamsParticipationPlusSelfVocabulary, self)
- for person in super_class.__iter__():
- yield person
+ yield from super().__iter__()
def getTermByToken(self, token):
"""See `IVocabularyTokenized`."""
logged_in_user = getUtility(ILaunchBag).user
if logged_in_user.name == token:
return self.getTerm(logged_in_user)
- super_class = super(UserTeamsParticipationPlusSelfVocabulary, self)
- return super_class.getTermByToken(token)
+ return super().getTermByToken(token)
class AllUserTeamsParticipationPlusSelfVocabulary(
@@ -1106,8 +1103,7 @@ class AllUserTeamsParticipationPlusSelfVocabulary(
INCLUDE_PRIVATE_TEAM = True
def __init__(self, context=None):
- super_class = super(AllUserTeamsParticipationPlusSelfVocabulary, self)
- super_class.__init__(context)
+ super().__init__(context)
if IBranch.providedBy(context):
self.EXCLUSIVE_TEAMS_ONLY = (
len(list(context.associatedProductSeries())) > 0)
@@ -1428,7 +1424,7 @@ class MilestoneWithDateExpectedVocabulary(MilestoneVocabulary):
def toTerm(self, obj):
"""See `IVocabulary`."""
- term = super(MilestoneWithDateExpectedVocabulary, self).toTerm(obj)
+ term = super().toTerm(obj)
if obj.dateexpected:
formatter = DateTimeFormatterAPI(obj.dateexpected)
term.title += ' (%s)' % formatter.approximatedate()
@@ -1852,8 +1848,7 @@ class PillarVocabularyBase(NamedStormHugeVocabulary):
def getTermByToken(self, token):
"""See `IVocabularyTokenized`."""
# Pillar names are always lowercase.
- return super(PillarVocabularyBase, self).getTermByToken(
- token.lower())
+ return super().getTermByToken(token.lower())
def __contains__(self, obj):
raise NotImplementedError
@@ -2019,8 +2014,7 @@ class SourcePackageNameVocabulary(NamedStormHugeVocabulary):
def getTermByToken(self, token):
"""See `IVocabularyTokenized`."""
# Package names are always lowercase.
- return super(SourcePackageNameVocabulary, self).getTermByToken(
- token.lower())
+ return super().getTermByToken(token.lower())
@implementer(IHugeVocabulary)
@@ -2217,7 +2211,7 @@ class OCIProjectVocabulary(StormVocabularyBase):
step_title = 'Search'
def __init__(self, context=None):
- super(OCIProjectVocabulary, self).__init__(context)
+ super().__init__(context)
self.pillar = None
def setPillar(self, pillar):
@@ -2240,7 +2234,7 @@ class OCIProjectVocabulary(StormVocabularyBase):
@property
def _entries(self):
- return getUtility(IOCIProjectSet).searchByName(u'')
+ return getUtility(IOCIProjectSet).searchByName('')
def __contains__(self, obj):
found_obj = IStore(self._table).find(
@@ -2258,7 +2252,7 @@ class DistributionPackageVocabulary:
"""
def __init__(self, context=None):
- super(DistributionPackageVocabulary, self).__init__()
+ super().__init__()
if bool(getFeatureFlag('disclosure.dsp_picker.enabled')):
# Replace the default field with a field that uses the better
# vocabulary.