← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:baseexception-repr-py37 into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:baseexception-repr-py37 into launchpad:master.

Commit message:
Handle BaseException.__repr__ changes in Python 3.7

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

Python 3.7 removed the trailing comma from the `repr` of single-argument exceptions.  Adjust a few tests to tolerate this.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:baseexception-repr-py37 into launchpad:master.
diff --git a/lib/lp/code/model/tests/test_sourcepackagerecipebuild.py b/lib/lp/code/model/tests/test_sourcepackagerecipebuild.py
index 2b0f4ad..39b6193 100644
--- a/lib/lp/code/model/tests/test_sourcepackagerecipebuild.py
+++ b/lib/lp/code/model/tests/test_sourcepackagerecipebuild.py
@@ -27,6 +27,7 @@ from lp.registry.interfaces.series import SeriesStatus
 from lp.services.database.interfaces import IStore
 from lp.services.log.logger import BufferLogger
 from lp.services.webapp.authorization import check_permission
+from lp.soyuz.interfaces.archive import ArchiveDisabled, CannotUploadToPPA
 from lp.testing import (
     ANONYMOUS,
     TestCaseWithFactory,
@@ -335,8 +336,8 @@ class TestSourcePackageRecipeBuild(TestCaseWithFactory):
         self.assertEqual([], daily_builds)
         self.assertEqual(
             "DEBUG Recipe eric/funky-recipe is stale\n"
-            "DEBUG  - daily build failed for Warty (4.10): "
-            + "ArchiveDisabled(%r,)\n" % "PPA for Eric is disabled.",
+            "DEBUG  - daily build failed for Warty (4.10): %r\n"
+            % ArchiveDisabled("PPA for Eric"),
             logger.getLogBuffer(),
         )
 
@@ -355,9 +356,8 @@ class TestSourcePackageRecipeBuild(TestCaseWithFactory):
         self.assertEqual([], daily_builds)
         self.assertEqual(
             "DEBUG Recipe eric/funky-recipe is stale\n"
-            "DEBUG  - daily build failed for Warty (4.10): "
-            "CannotUploadToPPA('Signer has no upload rights "
-            "to this PPA.',)\n",
+            "DEBUG  - daily build failed for Warty (4.10): %r\n"
+            % CannotUploadToPPA(),
             logger.getLogBuffer(),
         )
 
diff --git a/lib/lp/soyuz/tests/test_archivejob.py b/lib/lp/soyuz/tests/test_archivejob.py
index cc3cff0..8d36944 100644
--- a/lib/lp/soyuz/tests/test_archivejob.py
+++ b/lib/lp/soyuz/tests/test_archivejob.py
@@ -44,6 +44,7 @@ from lp.soyuz.model.archivejob import (
     ArchiveJobDerived,
     CIBuildUploadJob,
     PackageUploadNotificationJob,
+    ScanException,
 )
 from lp.soyuz.tests import datadir
 from lp.testing import TestCaseWithFactory, admin_logged_in, person_logged_in
@@ -1485,8 +1486,14 @@ class TestCIBuildUploadJob(TestCaseWithFactory):
             "Running %r (ID %d) in status Waiting" % (job, job.job_id),
             "Failed to scan _invalid.whl as a Python wheel: Invalid wheel "
             "filename: '_invalid.whl'",
-            '%r (ID %d) failed with user error ScanException("Could not find '
-            "any usable files in ['_invalid.whl']\",)." % (job, job.job_id),
+            "%r (ID %d) failed with user error %r."
+            % (
+                job,
+                job.job_id,
+                ScanException(
+                    "Could not find any usable files in ['_invalid.whl']"
+                ),
+            ),
         ]
         self.assertEqual(expected_logs, logger.output.splitlines())
         [notification] = self.assertEmailQueueLength(1)