[Pkg-privacy-commits] [monkeysign] 01/01: attempt to make tests with with a non-unicode locale, failed

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:34:15 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch dev/lang=c-tests
in repository monkeysign.

commit 9c8ba0898276a738ab662bfc10d32381fc6f2c6b
Author: Antoine Beaupré <anarcat at koumbit.org>
Date:   Sat Feb 15 18:38:28 2014 -0500

    attempt to make tests with with a non-unicode locale, failed
---
 monkeysign/gpg.py | 6 +++---
 tests/test_gpg.py | 8 +++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/monkeysign/gpg.py b/monkeysign/gpg.py
index 26f995b..4b0c159 100644
--- a/monkeysign/gpg.py
+++ b/monkeysign/gpg.py
@@ -358,7 +358,7 @@ class Keyring():
                 for keydata in self.context.stdout.split("pub:"):
                     if not keydata: continue
                     keydata = "pub:" + keydata
-                    key = OpenPGPkey(keydata)
+                    key = OpenPGPkey(keydata.decode('utf-8'))
                     keys[key.fpr] = key
             elif self.context.returncode == 2:
                 return None
@@ -415,7 +415,7 @@ class Keyring():
         self.context.expect(proc.stderr, 'GET_LINE keyedit.prompt')
         while True:
             m = self.context.seek_pattern(proc.stdout, '^uid:.::::::::([^:]*):::[^:]*:(\d+),[^:]*:')
-            if m and m.group(1) == pattern:
+            if m and m.group(1).decode('utf-8') == pattern:
                 # XXX: we don't have the +1 that sign_key has, why?
                 index = int(m.group(2))
                 break
@@ -452,7 +452,7 @@ class Keyring():
         # keyid, but we should really load those uids from the
         # output of --sign-key
         if self.context.debug: print >>self.context.debug, 'command:', self.context.build_command([['sign-key', 'lsign-key'][local], pattern])
-        proc = subprocess.Popen(self.context.build_command([['sign-key', 'lsign-key'][local], pattern]), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        proc = subprocess.Popen(self.context.build_command([['sign-key', 'lsign-key'][local], pattern.encode('utf-8')]), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 
         # if there are multiple uids to sign, we'll get this point, and a whole other interface
         try:
diff --git a/tests/test_gpg.py b/tests/test_gpg.py
index d00a2e0..9be46f1 100755
--- a/tests/test_gpg.py
+++ b/tests/test_gpg.py
@@ -235,7 +235,8 @@ class TestKeyringWithKeys(TestKeyringBase):
 
     def test_sign_key_one_uid(self):
         """test signature of a single uid"""
-        self.assertTrue(self.gpg.sign_key('Antoine Beaupré <anarcat at debian.org>'))
+        self.gpg.context.debug = sys.stderr
+        self.assertTrue(self.gpg.sign_key(u'Antoine Beaupré <anarcat at debian.org>'))
         self.gpg.context.call_command(['list-sigs', '7B75921E'])
         self.assertRegexpMatches(self.gpg.context.stdout, 'sig:::1:86E4E70A96F47C6A:[^:]*::::Second Test Key <unittests at monkeysphere.info>:10x:')
 
@@ -284,9 +285,10 @@ class TestKeyringWithKeys(TestKeyringBase):
 
     def test_del_uid(self):
         """test uid deletion, gpg.del_uid()"""
-        userid = 'Antoine Beaupré <anarcat at orangeseeds.org>'
+        userid = u'Antoine Beaupré <anarcat at orangeseeds.org>'
         self.assertTrue(self.gpg.import_data(open(os.path.dirname(__file__) + '/7B75921E.asc').read()))
         found = False
+        self.gpg.context.debug = sys.stderr
         keys = self.gpg.get_keys('7B75921E')
         for fpr, key in keys.iteritems():
             for u, uid in key.uids.iteritems():
@@ -303,7 +305,7 @@ class TestKeyringWithKeys(TestKeyringBase):
     def test_del_uid_except(self):
         """see if we can easily delete all uids except a certain one"""
         self.assertTrue(self.gpg.import_data(open(os.path.dirname(__file__) + '/7B75921E.asc').read()))
-        userid = 'Antoine Beaupré <anarcat at orangeseeds.org>'
+        userid = u'Antoine Beaupré <anarcat at orangeseeds.org>'
         keys = self.gpg.get_keys('7B75921E')
         todelete = []
         # XXX: otherwise test fails with GpgProtocolError: [Errno 0] expected "^\[GNUPG:\] GET_LINE keyedit.prompt", found "gpg: vérification de la base de confiance"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/monkeysign.git



More information about the Pkg-privacy-commits mailing list