launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27842
[Merge] ~cjwatson/launchpad:pyupgrade-py3-buildmaster into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:pyupgrade-py3-buildmaster into launchpad:master.
Commit message:
lp.buildmaster: Apply "pyupgrade --py3-plus"
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/413164
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:pyupgrade-py3-buildmaster into launchpad:master.
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index 78c032b..9a8f650 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -8,3 +8,13 @@
c348b945c29c723201380d9aca0e0c0298037c8c
# apply pyupgrade --py3-plus to lp.archiveuploader
65c3806b29ddd3d989a1b5a900c40e6599a38c3f
+# apply pyupgrade --py3-plus to lp.blueprints
+13dd22f798bdf4b564c387456e989127fde80195
+# apply pyupgrade --py3-plus to lp.bugs.{browser,externalbugtracker}
+93f0df63122a04197337e53197b4ac2d2048ab97
+# apply pyupgrade --py3-plus to lp.bugs.{interface,model}
+8f4ad57b8f0943040d28fcf7204c581b481bff73
+# apply pyupgrade --py3-plus to lp.bugs
+7f2f3372cfc3b59e805ddce7434757f068adcd26
+# apply pyupgrade --py3-plus to lp.buildmaster
+b6725842a2470e3927bb73bf400c4476a06ee3ba
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 76048b1..8abd4c3 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -46,6 +46,7 @@ repos:
|archiveuploader
|blueprints
|bugs
+ |buildmaster
)/
- repo: https://github.com/PyCQA/isort
rev: 5.9.2
diff --git a/lib/lp/buildmaster/browser/builder.py b/lib/lp/buildmaster/browser/builder.py
index ac718de..6fa3e16 100644
--- a/lib/lp/buildmaster/browser/builder.py
+++ b/lib/lp/buildmaster/browser/builder.py
@@ -23,7 +23,6 @@ import operator
from lazr.restful.utils import smartquote
import pytz
-import six
from zope.component import getUtility
from zope.event import notify
from zope.formlib.widget import CustomWidgetFactory
@@ -308,7 +307,7 @@ class BuilderCategory:
else:
grouped_builders[processor] = [builder]
- for processor, builders in six.iteritems(grouped_builders):
+ for processor, builders in grouped_builders.items():
virt_str = 'virt' if self.virtualized else 'nonvirt'
processor_name = processor.name if processor else None
queue_size, duration = build_queue_sizes[virt_str].get(
diff --git a/lib/lp/buildmaster/browser/tests/test_builder.py b/lib/lp/buildmaster/browser/tests/test_builder.py
index c9185ff..0a3ce50 100644
--- a/lib/lp/buildmaster/browser/tests/test_builder.py
+++ b/lib/lp/buildmaster/browser/tests/test_builder.py
@@ -122,7 +122,7 @@ class TestBuildersHomepage(TestCaseWithFactory, BuildCreationMixin):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(TestBuildersHomepage, self).setUp()
+ super().setUp()
# Create a non-buildfarm job to ensure that the BuildQueue and
# Job IDs differ, detecting bug #919116.
Job()
diff --git a/lib/lp/buildmaster/browser/tests/test_builder_views.py b/lib/lp/buildmaster/browser/tests/test_builder_views.py
index 5a903ce..2233d21 100644
--- a/lib/lp/buildmaster/browser/tests/test_builder_views.py
+++ b/lib/lp/buildmaster/browser/tests/test_builder_views.py
@@ -110,7 +110,7 @@ class TestgetSpecificJobs(TestCaseWithFactory):
getSpecificJobs, [build_farm_job])
-class BuildCreationMixin(object):
+class BuildCreationMixin:
def markAsBuilt(self, build, builder):
lfa = self.factory.makeLibraryFileAlias()
@@ -162,7 +162,7 @@ class TestBuilderHistoryView(TestCaseWithFactory, BuildCreationMixin):
nb_objects = 2
def setUp(self):
- super(TestBuilderHistoryView, self).setUp()
+ super().setUp()
self.builder = self.factory.makeBuilder()
def test_build_history_queries_count_view_recipe_builds(self):
diff --git a/lib/lp/buildmaster/interactor.py b/lib/lp/buildmaster/interactor.py
index 796ea92..ea8c962 100644
--- a/lib/lp/buildmaster/interactor.py
+++ b/lib/lp/buildmaster/interactor.py
@@ -123,7 +123,7 @@ def shut_down_default_process_pool():
_default_process_pool_shutdown = None
-class BuilderSlave(object):
+class BuilderSlave:
"""Add in a few useful methods for the XMLRPC slave.
:ivar url: The URL of the actual builder. The XML-RPC resource and
@@ -342,7 +342,7 @@ def extract_vitals_from_db(builder, build_queue=_BQ_UNSPECIFIED):
builder.clean_status, builder.active, builder.failure_count)
-class BuilderInteractor(object):
+class BuilderInteractor:
@staticmethod
def makeSlaveFromVitals(vitals):
@@ -549,7 +549,7 @@ class BuilderInteractor(object):
"""
builder_status = slave_status["builder_status"]
if builder_status == "BuilderStatus.ABORTING":
- logtail = u"Waiting for slave process to be terminated"
+ logtail = "Waiting for slave process to be terminated"
elif slave_status.get("logtail") is not None:
# slave_status["logtail"] is an xmlrpc.client.Binary instance,
# and the contents might include invalid UTF-8 due to being a
@@ -560,7 +560,7 @@ class BuilderInteractor(object):
# PostgreSQL text columns can't contain \0 characters, and since
# we only use this for web UI display purposes there's no point
# in going through contortions to store them.
- logtail = logtail.replace(u"\0", u"")
+ logtail = logtail.replace("\0", "")
else:
logtail = None
return logtail
diff --git a/lib/lp/buildmaster/interfaces/builder.py b/lib/lp/buildmaster/interfaces/builder.py
index 7cd8cdd..81861e0 100644
--- a/lib/lp/buildmaster/interfaces/builder.py
+++ b/lib/lp/buildmaster/interfaces/builder.py
@@ -78,7 +78,7 @@ class CannotFetchFile(BuildDaemonError):
"""The slave was unable to fetch the file."""
def __init__(self, file_url, error_information):
- super(CannotFetchFile, self).__init__()
+ super().__init__()
self.file_url = file_url
self.error_information = error_information
diff --git a/lib/lp/buildmaster/manager.py b/lib/lp/buildmaster/manager.py
index 9cec957..b78c912 100644
--- a/lib/lp/buildmaster/manager.py
+++ b/lib/lp/buildmaster/manager.py
@@ -251,7 +251,7 @@ class PrefetchedBuilderFactory(BaseBuilderFactory):
"""
def __init__(self, *args, **kwargs):
- super(PrefetchedBuilderFactory, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
# This needs to exist to avoid race conditions between
# `updateStats` and `update`.
self.vitals_map = {}
@@ -286,7 +286,7 @@ class PrefetchedBuilderFactory(BaseBuilderFactory):
def iterVitals(self):
"""See `BaseBuilderFactory`."""
- return (b for n, b in sorted(six.iteritems(self.vitals_map)))
+ return (b for n, b in sorted(self.vitals_map.items()))
def findBuildCandidate(self, vitals):
"""See `BaseBuilderFactory`."""
@@ -401,7 +401,7 @@ def recover_failure(logger, vitals, builder, retry, exception):
# We've already tried resetting it enough times, so we have
# little choice but to give up.
logger.info("Failing builder %s.", builder.name)
- builder.failBuilder(six.text_type(exception))
+ builder.failBuilder(str(exception))
elif builder_action == True:
# Dirty the builder to attempt recovery. In the virtual case,
# the dirty idleness will cause a reset, giving us a good chance
diff --git a/lib/lp/buildmaster/model/builder.py b/lib/lp/buildmaster/model/builder.py
index d340659..2bbd0d4 100644
--- a/lib/lp/buildmaster/model/builder.py
+++ b/lib/lp/buildmaster/model/builder.py
@@ -93,7 +93,7 @@ class Builder(StormBase):
def __init__(self, processors, url, name, title, owner, active=True,
virtualized=True, vm_host=None, vm_reset_protocol=None,
builderok=True, manual=False):
- super(Builder, self).__init__()
+ super().__init__()
# The processors cache starts out empty so that the processors
# property setter doesn't issue an additional query.
get_property_cache(self)._processors_cache = []
@@ -229,7 +229,7 @@ class BuilderProcessor(StormBase):
@implementer(IBuilderSet)
-class BuilderSet(object):
+class BuilderSet:
"""See IBuilderSet"""
def __init__(self):
diff --git a/lib/lp/buildmaster/model/buildfarmjob.py b/lib/lp/buildmaster/model/buildfarmjob.py
index 86ff563..876546d 100644
--- a/lib/lp/buildmaster/model/buildfarmjob.py
+++ b/lib/lp/buildmaster/model/buildfarmjob.py
@@ -96,7 +96,7 @@ class BuildFarmJob(Storm):
def __init__(self, job_type, status=BuildStatus.NEEDSBUILD,
date_created=None, builder=None, archive=None):
- super(BuildFarmJob, self).__init__()
+ super().__init__()
(self.job_type, self.status, self.builder, self.archive) = (
job_type, status, builder, archive)
if date_created is not None:
diff --git a/lib/lp/buildmaster/model/buildqueue.py b/lib/lp/buildmaster/model/buildqueue.py
index 6556b64..f82102d 100644
--- a/lib/lp/buildmaster/model/buildqueue.py
+++ b/lib/lp/buildmaster/model/buildqueue.py
@@ -12,7 +12,6 @@ import logging
from operator import attrgetter
import pytz
-import six
from storm.expr import (
And,
Desc,
@@ -92,7 +91,7 @@ class BuildQueue(StormBase):
def __init__(self, build_farm_job, estimated_duration=DEFAULT,
virtualized=DEFAULT, processor=DEFAULT, lastscore=None):
- super(BuildQueue, self).__init__()
+ super().__init__()
self._build_farm_job = build_farm_job
self.estimated_duration = estimated_duration
self.virtualized = virtualized
@@ -250,7 +249,7 @@ class BuildQueue(StormBase):
@implementer(IBuildQueueSet)
-class BuildQueueSet(object):
+class BuildQueueSet:
"""Utility to deal with BuildQueue content class."""
def get(self, buildqueue_id):
@@ -309,7 +308,7 @@ class BuildQueueSet(object):
job_type_conditions = []
job_sources = specific_build_farm_job_sources()
- for job_type, job_source in six.iteritems(job_sources):
+ for job_type, job_source in job_sources.items():
query = job_source.addCandidateSelectionCriteria()
if query:
job_type_conditions.append(
diff --git a/lib/lp/buildmaster/model/packagebuild.py b/lib/lp/buildmaster/model/packagebuild.py
index b257289..1ea37c1 100644
--- a/lib/lp/buildmaster/model/packagebuild.py
+++ b/lib/lp/buildmaster/model/packagebuild.py
@@ -50,7 +50,7 @@ class PackageBuildMixin(BuildFarmJobMixin):
def updateStatus(self, status, builder=None, slave_status=None,
date_started=None, date_finished=None,
force_invalid_transition=False):
- super(PackageBuildMixin, self).updateStatus(
+ super().updateStatus(
status, builder=builder, slave_status=slave_status,
date_started=date_started, date_finished=date_finished,
force_invalid_transition=force_invalid_transition)
diff --git a/lib/lp/buildmaster/queuedepth.py b/lib/lp/buildmaster/queuedepth.py
index c4612fa..ed53342 100644
--- a/lib/lp/buildmaster/queuedepth.py
+++ b/lib/lp/buildmaster/queuedepth.py
@@ -12,7 +12,6 @@ from datetime import (
)
from pytz import utc
-import six
from storm.expr import Count
from lp.buildmaster.enums import BuildQueueStatus
@@ -274,7 +273,7 @@ def estimate_job_delay(bq, builder_stats):
sum_of_delays = 0
# Now devide the delays based on a jobs/builders comparison.
- for platform, duration in six.iteritems(delays):
+ for platform, duration in delays.items():
jobs = job_counts[platform]
builders = builder_stats[platform]
# If there are less jobs than builders that can take them on,
diff --git a/lib/lp/buildmaster/tests/builderproxy.py b/lib/lp/buildmaster/tests/builderproxy.py
index 12944e5..5e9e4ac 100644
--- a/lib/lp/buildmaster/tests/builderproxy.py
+++ b/lib/lp/buildmaster/tests/builderproxy.py
@@ -96,7 +96,7 @@ class ProxyURLMatcher(MatchesStructure):
"""Check that a string is a valid url for a builder proxy."""
def __init__(self, job, now):
- super(ProxyURLMatcher, self).__init__(
+ super().__init__(
scheme=Equals("http"),
username=Equals("{}-{}".format(
job.build.build_cookie, int(now))),
@@ -106,14 +106,14 @@ class ProxyURLMatcher(MatchesStructure):
path=Equals(""))
def match(self, matchee):
- super(ProxyURLMatcher, self).match(urlsplit(matchee))
+ super().match(urlsplit(matchee))
class RevocationEndpointMatcher(Equals):
"""Check that a string is a valid endpoint for proxy token revocation."""
def __init__(self, job, now):
- super(RevocationEndpointMatcher, self).__init__(
+ super().__init__(
"{}/{}-{}".format(
config.builddmaster.builder_proxy_auth_api_endpoint,
job.build.build_cookie, int(now)))
diff --git a/lib/lp/buildmaster/tests/mock_slaves.py b/lib/lp/buildmaster/tests/mock_slaves.py
index ba8fb8f..a0f9c9b 100644
--- a/lib/lp/buildmaster/tests/mock_slaves.py
+++ b/lib/lp/buildmaster/tests/mock_slaves.py
@@ -24,7 +24,6 @@ import xmlrpc.client
import fixtures
from lpbuildd.tests.harness import BuilddSlaveTestSetup
-import six
from testtools.content import attach_file
from twisted.internet import defer
from twisted.web.xmlrpc import Proxy
@@ -154,7 +153,7 @@ class BuildingSlave(OkSlave):
"""A mock slave that looks like it's currently building."""
def __init__(self, build_id='1-1'):
- super(BuildingSlave, self).__init__()
+ super().__init__()
self.build_id = build_id
self.status_count = 0
@@ -172,7 +171,7 @@ class BuildingSlave(OkSlave):
def getFile(self, sum, file_to_write):
self.call_log.append('getFile')
if sum == "buildlog":
- if isinstance(file_to_write, six.string_types):
+ if isinstance(file_to_write, str):
file_to_write = open(file_to_write, 'wb')
file_to_write.write(b"This is a build log")
file_to_write.close()
@@ -184,7 +183,7 @@ class WaitingSlave(OkSlave):
def __init__(self, state='BuildStatus.OK', dependencies=None,
build_id='1-1', filemap=None):
- super(WaitingSlave, self).__init__()
+ super().__init__()
self.state = state
self.dependencies = dependencies
self.build_id = build_id
@@ -211,7 +210,7 @@ class WaitingSlave(OkSlave):
def getFile(self, hash, file_to_write):
self.call_log.append('getFile')
if hash in self.valid_files:
- if isinstance(file_to_write, six.string_types):
+ if isinstance(file_to_write, str):
file_to_write = open(file_to_write, 'wb')
if not self.valid_files[hash]:
content = ("This is a %s" % hash).encode("ASCII")
@@ -289,7 +288,7 @@ class LPBuilddSlaveTestSetup(BuilddSlaveTestSetup):
"""A BuilddSlaveTestSetup that uses the LP virtualenv."""
def setUp(self):
- super(LPBuilddSlaveTestSetup, self).setUp(
+ super().setUp(
python_path=sys.executable,
twistd_script=twistd_script)
diff --git a/lib/lp/buildmaster/tests/test_builder.py b/lib/lp/buildmaster/tests/test_builder.py
index a1111d5..55f3908 100644
--- a/lib/lp/buildmaster/tests/test_builder.py
+++ b/lib/lp/buildmaster/tests/test_builder.py
@@ -105,7 +105,7 @@ class TestFindBuildCandidatesBase(TestCaseWithFactory):
layer = LaunchpadZopelessLayer
def setUp(self):
- super(TestFindBuildCandidatesBase, self).setUp()
+ super().setUp()
self.publisher = make_publisher()
self.publisher.prepareBreezyAutotest()
@@ -277,7 +277,7 @@ class TestFindBuildCandidatesPPABase(TestFindBuildCandidatesBase):
def setUp(self):
"""Publish some builds for the test archive."""
- super(TestFindBuildCandidatesPPABase, self).setUp()
+ super().setUp()
# Create two PPAs and add some builds to each.
self.ppa_joe = self.factory.makeArchive(
@@ -370,7 +370,7 @@ class TestFindBuildCandidatesDistroArchive(TestFindBuildCandidatesBase):
def setUp(self):
"""Publish some builds for the test archive."""
- super(TestFindBuildCandidatesDistroArchive, self).setUp()
+ super().setUp()
# Create a primary archive and publish some builds for the
# queue.
self.non_ppa = self.factory.makeArchive(
@@ -432,7 +432,7 @@ class TestFindRecipeBuildCandidates(TestFindBuildCandidatesBase):
def setUp(self):
"""Publish some builds for the test archive."""
- super(TestFindRecipeBuildCandidates, self).setUp()
+ super().setUp()
# Create a primary archive and publish some builds for the
# queue.
self.non_ppa = self.factory.makeArchive(
diff --git a/lib/lp/buildmaster/tests/test_buildfarmjob.py b/lib/lp/buildmaster/tests/test_buildfarmjob.py
index ae26830..a10dfb0 100644
--- a/lib/lp/buildmaster/tests/test_buildfarmjob.py
+++ b/lib/lp/buildmaster/tests/test_buildfarmjob.py
@@ -44,7 +44,7 @@ class TestBuildFarmJobBase:
def setUp(self):
"""Create a build farm job with which to test."""
- super(TestBuildFarmJobBase, self).setUp()
+ super().setUp()
self.build_farm_job = self.makeBuildFarmJob()
def makeBuildFarmJob(self, builder=None,
@@ -112,7 +112,7 @@ class TestBuildFarmJobMixin(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBuildFarmJobMixin, self).setUp()
+ super().setUp()
# BuildFarmJobMixin only operates as part of a concrete
# IBuildFarmJob implementation. Here we use BinaryPackageBuild.
self.build_farm_job = self.factory.makeBinaryPackageBuild()
@@ -225,7 +225,7 @@ class TestBuildFarmJobSet(TestBuildFarmJobBase, TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(TestBuildFarmJobSet, self).setUp()
+ super().setUp()
self.builder = self.factory.makeBuilder()
self.build_farm_job_set = getUtility(IBuildFarmJobSet)
diff --git a/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py b/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py
index 3d09daa..1980b1e 100644
--- a/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py
+++ b/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py
@@ -288,7 +288,7 @@ class TestGetUploadMethodsMixin:
raise NotImplementedError
def setUp(self):
- super(TestGetUploadMethodsMixin, self).setUp()
+ super().setUp()
self.build = self.makeBuild()
self.behaviour = IBuildFarmJobBehaviour(
self.build.buildqueue_record.specific_build)
@@ -316,7 +316,7 @@ class TestVerifySuccessfulBuildMixin:
raise NotImplementedError
def setUp(self):
- super(TestVerifySuccessfulBuildMixin, self).setUp()
+ super().setUp()
self.factory = LaunchpadObjectFactory()
def test_verifySuccessfulBuild_allows_modifiable_suite(self):
@@ -347,7 +347,7 @@ class TestHandleStatusMixin:
raise NotImplementedError
def setUp(self):
- super(TestHandleStatusMixin, self).setUp()
+ super().setUp()
self.factory = LaunchpadObjectFactory()
self.build = self.makeBuild()
# For the moment, we require a builder for the build so that
diff --git a/lib/lp/buildmaster/tests/test_buildqueue.py b/lib/lp/buildmaster/tests/test_buildqueue.py
index da11e87..36c338f 100644
--- a/lib/lp/buildmaster/tests/test_buildqueue.py
+++ b/lib/lp/buildmaster/tests/test_buildqueue.py
@@ -55,7 +55,7 @@ class TestBuildCancellation(TestCaseWithFactory):
layer = ZopelessDatabaseLayer
def setUp(self):
- super(TestBuildCancellation, self).setUp()
+ super().setUp()
self.builder = self.factory.makeBuilder()
def test_buildqueue_cancel_waiting(self):
@@ -140,7 +140,7 @@ class TestPlatformData(TestCaseWithFactory):
def setUp(self):
"""Set up a native x86 build for the test archive."""
- super(TestPlatformData, self).setUp()
+ super().setUp()
self.publisher = SoyuzTestPublisher()
self.publisher.prepareBreezyAutotest()
diff --git a/lib/lp/buildmaster/tests/test_interactor.py b/lib/lp/buildmaster/tests/test_interactor.py
index 013ab32..29901c2 100644
--- a/lib/lp/buildmaster/tests/test_interactor.py
+++ b/lib/lp/buildmaster/tests/test_interactor.py
@@ -118,7 +118,7 @@ class TestBuilderInteractor(TestCase):
run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=30)
def setUp(self):
- super(TestBuilderInteractor, self).setUp()
+ super().setUp()
self.addCleanup(shut_down_default_process_pool)
def test_extractBuildStatus_baseline(self):
@@ -505,7 +505,7 @@ class TestSlave(TestCase):
run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=30)
def setUp(self):
- super(TestSlave, self).setUp()
+ super().setUp()
self.slave_helper = self.useFixture(SlaveTestHelpers())
self.addCleanup(shut_down_default_process_pool)
@@ -700,7 +700,7 @@ class TestSlaveTimeouts(TestCase):
timeout=30)
def setUp(self):
- super(TestSlaveTimeouts, self).setUp()
+ super().setUp()
self.slave_helper = self.useFixture(SlaveTestHelpers())
self.clock = Clock()
self.proxy = DeadProxy(b"url")
@@ -747,7 +747,7 @@ class TestSlaveConnectionTimeouts(TestCase):
run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=30)
def setUp(self):
- super(TestSlaveConnectionTimeouts, self).setUp()
+ super().setUp()
self.slave_helper = self.useFixture(SlaveTestHelpers())
self.clock = Clock()
self.addCleanup(shut_down_default_process_pool)
@@ -779,7 +779,7 @@ class TestSlaveWithLibrarian(TestCaseWithFactory):
timeout=30)
def setUp(self):
- super(TestSlaveWithLibrarian, self).setUp()
+ super().setUp()
self.slave_helper = self.useFixture(SlaveTestHelpers())
self.addCleanup(shut_down_default_process_pool)
diff --git a/lib/lp/buildmaster/tests/test_manager.py b/lib/lp/buildmaster/tests/test_manager.py
index 8a7fd2d..e058811 100644
--- a/lib/lp/buildmaster/tests/test_manager.py
+++ b/lib/lp/buildmaster/tests/test_manager.py
@@ -9,7 +9,6 @@ import time
from unittest import mock
import xmlrpc.client
-import six
from testtools.matchers import Equals
from testtools.testcase import ExpectedException
from testtools.twistedsupport import AsynchronousDeferredRunTest
@@ -107,7 +106,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
Also adjust the sampledata in a way a build can be dispatched to
'bob' builder.
"""
- super(TestSlaveScannerScan, self).setUp()
+ super().setUp()
# Creating the required chroots needed for dispatching.
self.test_publisher = make_publisher()
ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
@@ -314,9 +313,8 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
class BrokenUTF8Slave(BuildingSlave):
@defer.inlineCallbacks
def status(self):
- status = yield super(BrokenUTF8Slave, self).status()
- status["logtail"] = xmlrpc.client.Binary(
- u"───".encode("UTF-8")[1:])
+ status = yield super().status()
+ status["logtail"] = xmlrpc.client.Binary("───".encode()[1:])
return status
builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME]
@@ -335,7 +333,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
scanner = self._getScanner()
yield scanner.scan()
scanner.manager.flushLogTails()
- self._checkJobUpdated(builder, job, logtail=u"\uFFFD\uFFFD──")
+ self._checkJobUpdated(builder, job, logtail="\uFFFD\uFFFD──")
@defer.inlineCallbacks
def test_scan_of_logtail_containing_nul(self):
@@ -344,7 +342,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
class NULSlave(BuildingSlave):
@defer.inlineCallbacks
def status(self):
- status = yield super(NULSlave, self).status()
+ status = yield super().status()
status["logtail"] = xmlrpc.client.Binary(b"foo\0bar\0baz")
return status
@@ -364,7 +362,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
scanner = self._getScanner()
yield scanner.scan()
scanner.manager.flushLogTails()
- self._checkJobUpdated(builder, job, logtail=u"foobarbaz")
+ self._checkJobUpdated(builder, job, logtail="foobarbaz")
@defer.inlineCallbacks
def test_scan_calls_builder_factory_prescanUpdate(self):
@@ -425,7 +423,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
@defer.inlineCallbacks
def status(self):
- status = yield super(SnapBuildingSlave, self).status()
+ status = yield super().status()
status["revision_id"] = self.revision_id
return status
@@ -592,7 +590,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
def test_update_slave_version(self):
# If the reported slave version differs from the DB's record of it,
# then scanning the builder updates the DB.
- slave = OkSlave(version=six.ensure_str("100"))
+ slave = OkSlave(version="100")
builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME]
builder.version = "99"
self._resetBuilder(builder)
@@ -610,8 +608,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory):
vitals = extract_vitals_from_db(builder)
scanner = self._getScanner()
with StormStatementRecorder() as recorder:
- scanner.updateVersion(
- vitals, {"builder_version": six.ensure_str("100")})
+ scanner.updateVersion(vitals, {"builder_version": "100"})
self.assertThat(recorder, HasQueryCount(Equals(0)))
@defer.inlineCallbacks
@@ -673,7 +670,7 @@ class TestSlaveScannerWithLibrarian(TestCaseWithFactory):
run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=20)
def setUp(self):
- super(TestSlaveScannerWithLibrarian, self).setUp()
+ super().setUp()
self.addCleanup(shut_down_default_process_pool)
@defer.inlineCallbacks
@@ -932,7 +929,7 @@ class TestSlaveScannerWithoutDB(TestCase):
run_tests_with = AsynchronousDeferredRunTest
def setUp(self):
- super(TestSlaveScannerWithoutDB, self).setUp()
+ super().setUp()
self.addCleanup(shut_down_default_process_pool)
def getScanner(self, builder_factory=None, interactor=None, slave=None,
@@ -1126,7 +1123,7 @@ class TestCancellationChecking(TestCaseWithFactory):
run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=20)
def setUp(self):
- super(TestCancellationChecking, self).setUp()
+ super().setUp()
builder_name = BOB_THE_BUILDER_NAME
self.builder = getUtility(IBuilderSet)[builder_name]
self.builder.virtualized = True
diff --git a/lib/lp/buildmaster/tests/test_packagebuild.py b/lib/lp/buildmaster/tests/test_packagebuild.py
index 6a57f6b..90d5adb 100644
--- a/lib/lp/buildmaster/tests/test_packagebuild.py
+++ b/lib/lp/buildmaster/tests/test_packagebuild.py
@@ -24,7 +24,7 @@ class TestPackageBuildMixin(TestCaseWithFactory):
layer = LaunchpadFunctionalLayer
def setUp(self):
- super(TestPackageBuildMixin, self).setUp()
+ super().setUp()
# BuildFarmJobMixin only operates as part of a concrete
# IBuildFarmJob implementation. Here we use
# SourcePackageRecipeBuild.
@@ -40,8 +40,8 @@ class TestPackageBuildMixin(TestCaseWithFactory):
def test_updateStatus_MANUALDEPWAIT_sets_dependencies(self):
# updateStatus sets dependencies for a MANUALDEPWAIT build.
self.package_build.updateStatus(
- BuildStatus.MANUALDEPWAIT, slave_status={'dependencies': u'deps'})
- self.assertEqual(u'deps', self.package_build.dependencies)
+ BuildStatus.MANUALDEPWAIT, slave_status={'dependencies': 'deps'})
+ self.assertEqual('deps', self.package_build.dependencies)
self.package_build.updateStatus(
BuildStatus.MANUALDEPWAIT, slave_status={})
self.assertEqual(None, self.package_build.dependencies)
@@ -50,8 +50,8 @@ class TestPackageBuildMixin(TestCaseWithFactory):
# updateStatus unsets existing dependencies when transitioning
# to another state.
self.package_build.updateStatus(
- BuildStatus.MANUALDEPWAIT, slave_status={'dependencies': u'deps'})
- self.assertEqual(u'deps', self.package_build.dependencies)
+ BuildStatus.MANUALDEPWAIT, slave_status={'dependencies': 'deps'})
+ self.assertEqual('deps', self.package_build.dependencies)
self.package_build.updateStatus(BuildStatus.NEEDSBUILD)
self.assertEqual(None, self.package_build.dependencies)
@@ -86,7 +86,7 @@ class TestPackageBuildMixin(TestCaseWithFactory):
def test_storeUploadLog_unicode(self):
# Unicode upload logs are uploaded as UTF-8.
- unicode_content = u"Some content \N{SNOWMAN}"
+ unicode_content = "Some content \N{SNOWMAN}"
self.package_build.storeUploadLog(unicode_content)
self.assertIsNotNone(self.package_build.upload_log)
self.assertEqual(
diff --git a/lib/lp/buildmaster/tests/test_queuedepth.py b/lib/lp/buildmaster/tests/test_queuedepth.py
index 87bb318..5dacf21 100644
--- a/lib/lp/buildmaster/tests/test_queuedepth.py
+++ b/lib/lp/buildmaster/tests/test_queuedepth.py
@@ -8,7 +8,6 @@ from datetime import (
)
from pytz import utc
-import six
from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
@@ -127,7 +126,7 @@ class TestBuildQueueBase(TestCaseWithFactory):
layer = LaunchpadZopelessLayer
def setUp(self):
- super(TestBuildQueueBase, self).setUp()
+ super().setUp()
self.publisher = SoyuzTestPublisher()
self.publisher.prepareBreezyAutotest()
@@ -246,7 +245,7 @@ class SingleArchBuildsBase(TestBuildQueueBase):
def setUp(self):
"""Set up some native x86 builds for the test archive."""
- super(SingleArchBuildsBase, self).setUp()
+ super().setUp()
# The builds will be set up as follows:
#
# gedit, p: 386, v:False e:0:01:00 *** s: 1001
@@ -517,7 +516,7 @@ class TestMinTimeToNextBuilder(SingleArchBuildsBase):
# The following job can only run on a native builder.
job = self.makeCustomBuildQueue(
- estimated_duration=111, sourcename=u'xxr-gftp', score=1055,
+ estimated_duration=111, sourcename='xxr-gftp', score=1055,
virtualized=False)
self.builds.append(job.specific_build)
@@ -538,7 +537,7 @@ class MultiArchBuildsBase(TestBuildQueueBase):
def setUp(self):
"""Set up some native x86 builds for the test archive."""
- super(MultiArchBuildsBase, self).setUp()
+ super().setUp()
# The builds will be set up as follows:
#
# gedit, p: hppa, v:False e:0:01:00 *** s: 1001
@@ -697,7 +696,7 @@ class TestMinTimeToNextBuilderMulti(MultiArchBuildsBase):
check_mintime_to_builder(self, job, 0)
# Let's disable all builders.
- for builders in six.itervalues(self.builders):
+ for builders in self.builders.values():
for builder in builders:
builder.builderok = False
@@ -767,15 +766,15 @@ class TestMultiArchJobDelayEstimation(MultiArchBuildsBase):
p=processor, v=virtualized, e=estimated_duration, s=score
"""
- super(TestMultiArchJobDelayEstimation, self).setUp()
+ super().setUp()
job = self.makeCustomBuildQueue(
virtualized=False, estimated_duration=22,
- sourcename=u'xx-recipe-bash', score=1025)
+ sourcename='xx-recipe-bash', score=1025)
self.builds.append(job.specific_build)
job = self.makeCustomBuildQueue(
virtualized=False, estimated_duration=222,
- sourcename=u'xx-recipe-zsh', score=1053)
+ sourcename='xx-recipe-zsh', score=1053)
self.builds.append(job.specific_build)
# Assign the same score to the '386' vim and apg build jobs.
@@ -897,33 +896,33 @@ class TestJobDispatchTimeEstimation(MultiArchBuildsBase):
p=processor, v=virtualized, e=estimated_duration, s=score
"""
- super(TestJobDispatchTimeEstimation, self).setUp()
+ super().setUp()
job = self.makeCustomBuildQueue(
virtualized=False, estimated_duration=332,
- sourcename=u'xxr-aptitude', score=1025)
+ sourcename='xxr-aptitude', score=1025)
self.builds.append(job.specific_build)
job = self.makeCustomBuildQueue(
virtualized=False, estimated_duration=443,
- sourcename=u'xxr-auto-apt', score=1053)
+ sourcename='xxr-auto-apt', score=1053)
self.builds.append(job.specific_build)
job = self.makeCustomBuildQueue(
- estimated_duration=554, sourcename=u'xxr-daptup', score=1051)
+ estimated_duration=554, sourcename='xxr-daptup', score=1051)
self.builds.append(job.specific_build)
job = self.makeCustomBuildQueue(
- estimated_duration=665, sourcename=u'xxr-cron-apt', score=1043)
+ estimated_duration=665, sourcename='xxr-cron-apt', score=1043)
self.builds.append(job.specific_build)
job = self.makeCustomBuildQueue(
- estimated_duration=776, sourcename=u'xxr-apt-build', score=1043)
+ estimated_duration=776, sourcename='xxr-apt-build', score=1043)
self.builds.append(job.specific_build)
job = self.makeCustomBuildQueue(
- estimated_duration=887, sourcename=u'xxr-debdelta', score=1044)
+ estimated_duration=887, sourcename='xxr-debdelta', score=1044)
self.builds.append(job.specific_build)
job = self.makeCustomBuildQueue(
- estimated_duration=998, sourcename=u'xxr-apt', score=1044)
+ estimated_duration=998, sourcename='xxr-apt', score=1044)
self.builds.append(job.specific_build)
job = self.makeCustomBuildQueue(
- estimated_duration=1110, sourcename=u'xxr-cupt', score=1044)
+ estimated_duration=1110, sourcename='xxr-cupt', score=1044)
self.builds.append(job.specific_build)
# Assign the same score to the '386' vim and apg build jobs.
diff --git a/lib/lp/buildmaster/tests/test_webservice.py b/lib/lp/buildmaster/tests/test_webservice.py
index d39292d..bc96432 100644
--- a/lib/lp/buildmaster/tests/test_webservice.py
+++ b/lib/lp/buildmaster/tests/test_webservice.py
@@ -31,7 +31,7 @@ class TestBuildersCollection(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBuildersCollection, self).setUp()
+ super().setUp()
self.webservice = LaunchpadWebServiceCaller()
def test_list(self):
@@ -128,7 +128,7 @@ class TestBuilderEntry(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
- super(TestBuilderEntry, self).setUp()
+ super().setUp()
self.webservice = LaunchpadWebServiceCaller()
def test_security(self):