← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:fix-super into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:fix-super into launchpad:master.

Commit message:
Fix incorrect type argument to super()

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Methods in several classes previously passed their superclass as the first argument to `super()` rather than their own class.  In all these cases this seems to have been a simple mistake of exactly the kind that's easy to make with two-argument `super()`.  Use the Python 3 zero-argument form here instead, since that's harder to get wrong.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-super into launchpad:master.
diff --git a/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py b/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py
index 3861a50..5e43664 100644
--- a/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py
+++ b/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py
@@ -159,7 +159,7 @@ class HelpersMixin:
 class TestNewerMtime(TestCase):
 
     def setUp(self):
-        super(TestCase, self).setUp()
+        super().setUp()
         tempdir = self.useTempDir()
         self.a = os.path.join(tempdir, "a")
         self.b = os.path.join(tempdir, "b")
diff --git a/lib/lp/scripts/tests/test_garbo.py b/lib/lp/scripts/tests/test_garbo.py
index 287960d..0d34fce 100644
--- a/lib/lp/scripts/tests/test_garbo.py
+++ b/lib/lp/scripts/tests/test_garbo.py
@@ -276,7 +276,7 @@ class TestSessionPruner(TestCase):
     layer = ZopelessDatabaseLayer
 
     def setUp(self):
-        super(TestCase, self).setUp()
+        super().setUp()
 
         # Session database isn't reset between tests. We need to do this
         # manually.
diff --git a/lib/lp/services/signing/tests/test_proxy.py b/lib/lp/services/signing/tests/test_proxy.py
index 5f7fe7e..6bceae8 100644
--- a/lib/lp/services/signing/tests/test_proxy.py
+++ b/lib/lp/services/signing/tests/test_proxy.py
@@ -191,7 +191,7 @@ class SigningServiceProxyTest(TestCaseWithFactory, TestWithFixtures):
     layer = ZopelessLayer
 
     def setUp(self, *args, **kwargs):
-        super(TestCaseWithFactory, self).setUp(*args, **kwargs)
+        super().setUp(*args, **kwargs)
         self.response_factory = SigningServiceResponseFactory()
 
         client = removeSecurityProxy(getUtility(ISigningServiceClient))
diff --git a/lib/lp/soyuz/interfaces/archive.py b/lib/lp/soyuz/interfaces/archive.py
index 9f60d5d..baaf5ba 100644
--- a/lib/lp/soyuz/interfaces/archive.py
+++ b/lib/lp/soyuz/interfaces/archive.py
@@ -307,7 +307,7 @@ class InvalidExternalDependencies(Exception):
 
     def __init__(self, errors):
         error_msg = 'Invalid external dependencies:\n%s\n' % '\n'.join(errors)
-        super(Exception, self).__init__(error_msg)
+        super().__init__(error_msg)
         self.errors = errors
 
 
diff --git a/lib/lp/soyuz/interfaces/distroarchseries.py b/lib/lp/soyuz/interfaces/distroarchseries.py
index 76d1930..45810fc 100644
--- a/lib/lp/soyuz/interfaces/distroarchseries.py
+++ b/lib/lp/soyuz/interfaces/distroarchseries.py
@@ -65,8 +65,7 @@ class ChrootNotPublic(Exception):
     """Raised when trying to set a chroot from a private livefs build."""
 
     def __init__(self):
-        super(Exception, self).__init__(
-            "Cannot set chroot from a private build.")
+        super().__init__("Cannot set chroot from a private build.")
 
 
 @error_status(http_client.BAD_REQUEST)
@@ -74,7 +73,7 @@ class FilterSeriesMismatch(Exception):
     """DAS and packageset distroseries do not match when setting a filter."""
 
     def __init__(self, distroarchseries, packageset):
-        super(Exception, self).__init__(
+        super().__init__(
             "The requested package set is for %s and cannot be set as a "
             "filter for %s %s." % (
                 packageset.distroseries.fullseriesname,