From 159505a28864399cc5405d9f85f35ab011a3259e Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Thu, 30 Mar 2017 14:58:29 +0200 Subject: [PATCH] python: Fix skipping tests if running with GnuPG < 2.1.12. * final.py: Import 'support.py' for the side-effect of checking the GnuPG version. * t-data.py: Likewise. * t-protocol-assuan.py: Likewise. * t-wrapper.py: Likewise. * t-callbacks.py: Avoid warning about 'support' being unused. * t-edit.py: Likewise. * t-encrypt-sym.py: Likewise. * t-file-name.py: Likewise. * t-idiomatic.py: Likewise. * t-sig-notation.py: Likewise. * t-trustlist.py: Likewise. * t-verify.py: Likewise. * t-wait.py: Likewise. * t-keylist-from-data.py: Trim unused imports. GnuPG-bug-id: 3008 Fixes-commit: 348da58fe0c3656e6177c98fef6b4c4331326c8e Signed-off-by: Justus Winter --- lang/python/tests/final.py | 2 ++ lang/python/tests/t-callbacks.py | 3 +-- lang/python/tests/t-data.py | 2 ++ lang/python/tests/t-edit.py | 3 +-- lang/python/tests/t-encrypt-sym.py | 3 +-- lang/python/tests/t-file-name.py | 1 + lang/python/tests/t-idiomatic.py | 1 + lang/python/tests/t-keylist-from-data.py | 2 -- lang/python/tests/t-protocol-assuan.py | 2 ++ lang/python/tests/t-sig-notation.py | 1 + lang/python/tests/t-trustlist.py | 1 + lang/python/tests/t-verify.py | 1 + lang/python/tests/t-wait.py | 1 + lang/python/tests/t-wrapper.py | 2 ++ 14 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lang/python/tests/final.py b/lang/python/tests/final.py index 8e7ab339..65375cb8 100755 --- a/lang/python/tests/final.py +++ b/lang/python/tests/final.py @@ -22,6 +22,8 @@ del absolute_import, print_function, unicode_literals import os import subprocess +import support +_ = support # to appease pyflakes. subprocess.check_call([os.path.join(os.getenv('top_srcdir'), "tests", "start-stop-agent"), "--stop"]) diff --git a/lang/python/tests/t-callbacks.py b/lang/python/tests/t-callbacks.py index 94cf11ef..9a70cdae 100755 --- a/lang/python/tests/t-callbacks.py +++ b/lang/python/tests/t-callbacks.py @@ -23,8 +23,7 @@ del absolute_import, print_function, unicode_literals import os import gpg import support - -support.assert_gpg_version() +_ = support # to appease pyflakes. c = gpg.Context() c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK) diff --git a/lang/python/tests/t-data.py b/lang/python/tests/t-data.py index d1facd40..33013193 100755 --- a/lang/python/tests/t-data.py +++ b/lang/python/tests/t-data.py @@ -24,6 +24,8 @@ import io import os import tempfile import gpg +import support +_ = support # to appease pyflakes. data = gpg.Data('Hello world!') assert data.read() == b'Hello world!' diff --git a/lang/python/tests/t-edit.py b/lang/python/tests/t-edit.py index ffc32965..b1075a96 100755 --- a/lang/python/tests/t-edit.py +++ b/lang/python/tests/t-edit.py @@ -25,8 +25,7 @@ import sys import os import gpg import support - -support.assert_gpg_version() +_ = support # to appease pyflakes. class KeyEditor(object): def __init__(self): diff --git a/lang/python/tests/t-encrypt-sym.py b/lang/python/tests/t-encrypt-sym.py index 8ee9cd6b..82992934 100755 --- a/lang/python/tests/t-encrypt-sym.py +++ b/lang/python/tests/t-encrypt-sym.py @@ -23,8 +23,7 @@ del absolute_import, print_function, unicode_literals import os import gpg import support - -support.assert_gpg_version() +_ = support # to appease pyflakes. for passphrase in ("abc", b"abc"): c = gpg.Context() diff --git a/lang/python/tests/t-file-name.py b/lang/python/tests/t-file-name.py index aab56802..32fe84a0 100755 --- a/lang/python/tests/t-file-name.py +++ b/lang/python/tests/t-file-name.py @@ -23,6 +23,7 @@ del absolute_import, print_function, unicode_literals import os import gpg import support +_ = support # to appease pyflakes. testname = "abcde12345" diff --git a/lang/python/tests/t-idiomatic.py b/lang/python/tests/t-idiomatic.py index 826bc23c..b7ae4eb9 100755 --- a/lang/python/tests/t-idiomatic.py +++ b/lang/python/tests/t-idiomatic.py @@ -26,6 +26,7 @@ import os import tempfile import gpg import support +_ = support # to appease pyflakes. # Both Context and Data can be used as context manager: with gpg.Context() as c, gpg.Data() as d: diff --git a/lang/python/tests/t-keylist-from-data.py b/lang/python/tests/t-keylist-from-data.py index 6a26267d..6503eb7a 100755 --- a/lang/python/tests/t-keylist-from-data.py +++ b/lang/python/tests/t-keylist-from-data.py @@ -20,8 +20,6 @@ from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals -import os -import sys import gpg import support diff --git a/lang/python/tests/t-protocol-assuan.py b/lang/python/tests/t-protocol-assuan.py index 27b28c72..8da50351 100755 --- a/lang/python/tests/t-protocol-assuan.py +++ b/lang/python/tests/t-protocol-assuan.py @@ -21,6 +21,8 @@ from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals import gpg +import support +_ = support # to appease pyflakes. with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c: # Do nothing. diff --git a/lang/python/tests/t-sig-notation.py b/lang/python/tests/t-sig-notation.py index 22774974..bc8da2e6 100755 --- a/lang/python/tests/t-sig-notation.py +++ b/lang/python/tests/t-sig-notation.py @@ -23,6 +23,7 @@ del absolute_import, print_function, unicode_literals import os import gpg import support +_ = support # to appease pyflakes. expected_notations = { "laughing@me": ("Just Squeeze Me", gpg.constants.sig.notation.HUMAN_READABLE), diff --git a/lang/python/tests/t-trustlist.py b/lang/python/tests/t-trustlist.py index 85865965..89524bb5 100755 --- a/lang/python/tests/t-trustlist.py +++ b/lang/python/tests/t-trustlist.py @@ -22,6 +22,7 @@ del absolute_import, print_function, unicode_literals import gpg import support +_ = support # to appease pyflakes. c = gpg.Context() diff --git a/lang/python/tests/t-verify.py b/lang/python/tests/t-verify.py index 03476382..320dae66 100755 --- a/lang/python/tests/t-verify.py +++ b/lang/python/tests/t-verify.py @@ -24,6 +24,7 @@ import sys import os import gpg import support +_ = support # to appease pyflakes. test_text1 = b"Just GNU it!\n" test_text1f= b"Just GNU it?\n" diff --git a/lang/python/tests/t-wait.py b/lang/python/tests/t-wait.py index 0c403fa6..31013011 100755 --- a/lang/python/tests/t-wait.py +++ b/lang/python/tests/t-wait.py @@ -23,6 +23,7 @@ del absolute_import, print_function, unicode_literals import time import gpg import support +_ = support # to appease pyflakes. c = gpg.Context() c.set_armor(True) diff --git a/lang/python/tests/t-wrapper.py b/lang/python/tests/t-wrapper.py index 79f047fa..08a320d2 100755 --- a/lang/python/tests/t-wrapper.py +++ b/lang/python/tests/t-wrapper.py @@ -18,6 +18,8 @@ # License along with this program; if not, see . import gpg +import support +_ = support # to appease pyflakes. d0 = gpg.Data() d0.seek # trigger on-demand-wrapping