When running the test suite in a system that uses the C locale, e.g. by running it as::
export LANG=C python test_gnupg.py
the tests that use the string "Hello, André" fail because of encoding to ascii issues::
====================================================================== ERROR: test_encryption_and_decryption (main.GPGTestCase) Test that encryption and decryption works
Traceback (most recent call last): File "test_gnupg_3.py", line 166, in test_encryption_and_decryption data = data.encode(gpg.encoding) UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 11: ordinal not in range(128)
====================================================================== ERROR: test_signature_verification (main.GPGTestCase) Test that signing and verification works
Traceback (most recent call last): File "test_gnupg_3.py", line 245, in test_signature_verification data = data.encode(self.gpg.encoding) UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 11: ordinal not in range(128)
This happens both with python 2 (2.6 and 2.7) and 3 (3.2).
I'm not sure what the correct behavior should be in this case.
Comment #1
Posted on May 31, 2012 by Swift LionI've changed the tests to use 'latin-1' encoding where this is known to be the encoding of the data. This appears to fix the problem.
Comment #2
Posted on Sep 1, 2012 by Swift Lion(No comment was entered for this change.)
Status: Fixed
Labels:
Type-Defect
Priority-Medium