aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/tests/t-encrypt-sym.py
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2020-07-14 12:46:58 +0000
committerWerner Koch <[email protected]>2020-07-14 12:48:01 +0000
commit32b80cf3c7d278ddf27117617a3e95e4a12c28c8 (patch)
treef9e1e025bc78cdfb8280e4d639096b097fde420a /lang/python/tests/t-encrypt-sym.py
parentdoc: Explain verify_result_t.status == 0 more (diff)
downloadgpgme-32b80cf3c7d278ddf27117617a3e95e4a12c28c8.tar.gz
gpgme-32b80cf3c7d278ddf27117617a3e95e4a12c28c8.zip
python: Workaround for a regression in GnuPG 2.2.21
* lang/python/tests/support.py (is_gpg_version): New. * lang/python/tests/t-encrypt-sym.py: Add workaround. -- GnuPG-bug-id: 4991 Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to '')
-rwxr-xr-xlang/python/tests/t-encrypt-sym.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/lang/python/tests/t-encrypt-sym.py b/lang/python/tests/t-encrypt-sym.py
index 4389a7d4..d22e0103 100755
--- a/lang/python/tests/t-encrypt-sym.py
+++ b/lang/python/tests/t-encrypt-sym.py
@@ -44,8 +44,16 @@ for passphrase in ("abc", b"abc"):
c.set_passphrase_cb(passphrase_cb, None)
c.op_encrypt([], 0, source, cipher)
- assert passphrase_cb_called == 1, \
- "Callback called {} times".format(passphrase_cb_called)
+ # gpg 2.2.21 has a bug in that for a new passphrase the callback
+ # is called twice. This is fixed in 2.2.22 but a patch was also
+ # distributed so that we allow both.
+ if support.is_gpg_version((2,2,21)):
+ print("Enabling GnuPG 2.2.21 bug 4991 test workaround.")
+ assert passphrase_cb_called == 1 or passphrase_cb_called == 2, \
+ "Callback called {} times".format(passphrase_cb_called)
+ else:
+ assert passphrase_cb_called == 1, \
+ "Callback called {} times".format(passphrase_cb_called)
support.print_data(cipher)
c = gpg.Context()