← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:upgrade-dkimpy into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:upgrade-dkimpy into launchpad:master.

Commit message:
Upgrade to dkimpy 1.0.4 and dnspython 1.16.0

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

We no longer need to explicitly require dnspython, since dkimpy now does that itself.

Explicitly require dkimpy[ed25519] for good measure; this doesn't incur any additional requirements in practice, since we already have PyNaCl installed for other reasons, but it seems like a good idea.

This adds Python 3 support.

Dependencies MP: https://code.launchpad.net/~cjwatson/lp-source-dependencies/+git/lp-source-dependencies/+merge/386891
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:upgrade-dkimpy into launchpad:master.
diff --git a/constraints.txt b/constraints.txt
index bf65925..603eff7 100644
--- a/constraints.txt
+++ b/constraints.txt
@@ -194,9 +194,8 @@ Cython==0.29.17
 d2to1==0.2.12
 defusedxml==0.6.0
 distro==1.4.0
-dkimpy==0.5.4
-# Required by dkimpy
-dnspython==1.10.0
+dkimpy==1.0.4
+dnspython==1.16.0
 dulwich==0.18.6
 eggtestinfo==0.3
 elementtree==1.2.6-20050316
diff --git a/lib/lp/services/mail/tests/test_dkim.py b/lib/lp/services/mail/tests/test_dkim.py
index c17f732..a8b2383 100644
--- a/lib/lp/services/mail/tests/test_dkim.py
+++ b/lib/lp/services/mail/tests/test_dkim.py
@@ -91,7 +91,7 @@ class TestDKIM(TestCaseWithFactory):
     def monkeypatch_dns(self):
         self._dns_responses = {}
 
-        def my_lookup(name):
+        def my_lookup(name, timeout=None):
             try:
                 return self._dns_responses[name]
             except KeyError:
@@ -170,7 +170,7 @@ Why isn't this fixed yet?""")
         self.assertEqual(principal.person.preferredemail.email,
             'foo.bar@xxxxxxxxxxxxx')
         self.assertDkimLogContains(
-            "DKIM error: KeyFormatError('incomplete public key:")
+            "ERROR unknown algorithm in k= tag")
 
     def test_dkim_garbage_pubkey(self):
         signed_message = self.fake_signing(self.makeMessageText())
@@ -180,7 +180,10 @@ Why isn't this fixed yet?""")
         self.assertWeaklyAuthenticated(principal, signed_message)
         self.assertEqual(principal.person.preferredemail.email,
             'foo.bar@xxxxxxxxxxxxx')
-        self.assertDkimLogContains("DKIM error: KeyFormatError(InvalidTagSpec")
+        # We seem to just get the public key as the error message, which
+        # isn't the most informative of errors, but this is buried inside
+        # dkimpy and there isn't much we can do about it.
+        self.assertDkimLogContains("ERROR abcdefg")
 
     def test_dkim_disabled(self):
         """With disabling flag set, mail isn't trusted."""
diff --git a/setup.py b/setup.py
index 0f8d35f..2aa246d 100644
--- a/setup.py
+++ b/setup.py
@@ -160,9 +160,7 @@ setup(
         'cssselect',
         'cssutils',
         'defusedxml',
-        'dkimpy',
-        # Required for dkimpy
-        'dnspython',
+        'dkimpy[ed25519]',
         'dulwich',
         'feedparser',
         'feedvalidator',