aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2017-03-20 15:00:13 +0000
committerJustus Winter <[email protected]>2017-03-20 15:20:02 +0000
commite1cf8bab319ba1dea41ba5d711dbb66ffd8e6fd6 (patch)
tree0c9eed23717440e3cb6083699347a542b1e507b6
parentpython: Remove superfluous initialization. (diff)
downloadgpgme-e1cf8bab319ba1dea41ba5d711dbb66ffd8e6fd6.tar.gz
gpgme-e1cf8bab319ba1dea41ba5d711dbb66ffd8e6fd6.zip
python: Skip tests if GnuPG is too old.
* lang/python/tests/support.py (assert_gpg_version): New function. * lang/python/tests/t-callbacks.py: Use the new function to skip the test if GnuPG is too old. * lang/python/tests/t-edit.py: Likewise. * lang/python/tests/t-encrypt-sym.py: Likewise. * lang/python/tests/t-quick-key-creation.py: Likewise. * lang/python/tests/t-quick-key-manipulation.py: Likewise. * lang/python/tests/t-quick-key-signing.py: Likewise. GnuPG-bug-id: 3008 Signed-off-by: Justus Winter <[email protected]>
-rw-r--r--lang/python/tests/support.py7
-rwxr-xr-xlang/python/tests/t-callbacks.py2
-rwxr-xr-xlang/python/tests/t-edit.py2
-rwxr-xr-xlang/python/tests/t-encrypt-sym.py2
-rwxr-xr-xlang/python/tests/t-quick-key-creation.py1
-rwxr-xr-xlang/python/tests/t-quick-key-manipulation.py1
-rwxr-xr-xlang/python/tests/t-quick-key-signing.py1
7 files changed, 16 insertions, 0 deletions
diff --git a/lang/python/tests/support.py b/lang/python/tests/support.py
index 80c3a4bf..8f9d6452 100644
--- a/lang/python/tests/support.py
+++ b/lang/python/tests/support.py
@@ -26,6 +26,13 @@ import tempfile
import time
import gpg
+def assert_gpg_version(version=(2, 1, 0)):
+ with gpg.Context() as c:
+ if tuple(map(int, c.engine_info.version.split('.'))) < version:
+ print("GnuPG too old: have {0}, need {1}.".format(
+ c.engine_info.version, '.'.join(version)))
+ sys.exit(77)
+
# known keys
alpha = "A0FF4590BB6122EDEF6E3C542D727CC768697734"
bob = "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2"
diff --git a/lang/python/tests/t-callbacks.py b/lang/python/tests/t-callbacks.py
index ae157878..94cf11ef 100755
--- a/lang/python/tests/t-callbacks.py
+++ b/lang/python/tests/t-callbacks.py
@@ -24,6 +24,8 @@ import os
import gpg
import support
+support.assert_gpg_version()
+
c = gpg.Context()
c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK)
diff --git a/lang/python/tests/t-edit.py b/lang/python/tests/t-edit.py
index 7ac3626f..ffc32965 100755
--- a/lang/python/tests/t-edit.py
+++ b/lang/python/tests/t-edit.py
@@ -26,6 +26,8 @@ import os
import gpg
import support
+support.assert_gpg_version()
+
class KeyEditor(object):
def __init__(self):
self.steps = ["fpr", "expire", "1", "primary", "quit"]
diff --git a/lang/python/tests/t-encrypt-sym.py b/lang/python/tests/t-encrypt-sym.py
index c15955a9..8ee9cd6b 100755
--- a/lang/python/tests/t-encrypt-sym.py
+++ b/lang/python/tests/t-encrypt-sym.py
@@ -24,6 +24,8 @@ import os
import gpg
import support
+support.assert_gpg_version()
+
for passphrase in ("abc", b"abc"):
c = gpg.Context()
c.set_armor(True)
diff --git a/lang/python/tests/t-quick-key-creation.py b/lang/python/tests/t-quick-key-creation.py
index c642c5b4..8b7372e7 100755
--- a/lang/python/tests/t-quick-key-creation.py
+++ b/lang/python/tests/t-quick-key-creation.py
@@ -25,6 +25,7 @@ import itertools
import time
import support
+support.assert_gpg_version((2, 1, 2))
alpha = "Alpha <[email protected]>"
diff --git a/lang/python/tests/t-quick-key-manipulation.py b/lang/python/tests/t-quick-key-manipulation.py
index 45e4c0e2..0f47006f 100755
--- a/lang/python/tests/t-quick-key-manipulation.py
+++ b/lang/python/tests/t-quick-key-manipulation.py
@@ -24,6 +24,7 @@ import os
import gpg
import support
+support.assert_gpg_version((2, 1, 14))
alpha = "Alpha <[email protected]>"
bravo = "Bravo <[email protected]>"
diff --git a/lang/python/tests/t-quick-key-signing.py b/lang/python/tests/t-quick-key-signing.py
index f9778a33..3d648c5b 100755
--- a/lang/python/tests/t-quick-key-signing.py
+++ b/lang/python/tests/t-quick-key-signing.py
@@ -25,6 +25,7 @@ import itertools
import time
import support
+support.assert_gpg_version((2, 1, 1))
with support.EphemeralContext() as ctx:
uid_counter = 0