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: 348da58fe0
Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2017-03-30 14:58:29 +02:00
parent 2c063a8d60
commit 159505a288
No known key found for this signature in database
GPG Key ID: DD1A52F9DA8C9020
14 changed files with 17 additions and 8 deletions

View File

@ -22,6 +22,8 @@ del absolute_import, print_function, unicode_literals
import os import os
import subprocess import subprocess
import support
_ = support # to appease pyflakes.
subprocess.check_call([os.path.join(os.getenv('top_srcdir'), subprocess.check_call([os.path.join(os.getenv('top_srcdir'),
"tests", "start-stop-agent"), "--stop"]) "tests", "start-stop-agent"), "--stop"])

View File

@ -23,8 +23,7 @@ del absolute_import, print_function, unicode_literals
import os import os
import gpg import gpg
import support import support
_ = support # to appease pyflakes.
support.assert_gpg_version()
c = gpg.Context() c = gpg.Context()
c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK) c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK)

View File

@ -24,6 +24,8 @@ import io
import os import os
import tempfile import tempfile
import gpg import gpg
import support
_ = support # to appease pyflakes.
data = gpg.Data('Hello world!') data = gpg.Data('Hello world!')
assert data.read() == b'Hello world!' assert data.read() == b'Hello world!'

View File

@ -25,8 +25,7 @@ import sys
import os import os
import gpg import gpg
import support import support
_ = support # to appease pyflakes.
support.assert_gpg_version()
class KeyEditor(object): class KeyEditor(object):
def __init__(self): def __init__(self):

View File

@ -23,8 +23,7 @@ del absolute_import, print_function, unicode_literals
import os import os
import gpg import gpg
import support import support
_ = support # to appease pyflakes.
support.assert_gpg_version()
for passphrase in ("abc", b"abc"): for passphrase in ("abc", b"abc"):
c = gpg.Context() c = gpg.Context()

View File

@ -23,6 +23,7 @@ del absolute_import, print_function, unicode_literals
import os import os
import gpg import gpg
import support import support
_ = support # to appease pyflakes.
testname = "abcde12345" testname = "abcde12345"

View File

@ -26,6 +26,7 @@ import os
import tempfile import tempfile
import gpg import gpg
import support import support
_ = support # to appease pyflakes.
# Both Context and Data can be used as context manager: # Both Context and Data can be used as context manager:
with gpg.Context() as c, gpg.Data() as d: with gpg.Context() as c, gpg.Data() as d:

View File

@ -20,8 +20,6 @@
from __future__ import absolute_import, print_function, unicode_literals from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals
import os
import sys
import gpg import gpg
import support import support

View File

@ -21,6 +21,8 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals
import gpg import gpg
import support
_ = support # to appease pyflakes.
with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c: with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c:
# Do nothing. # Do nothing.

View File

@ -23,6 +23,7 @@ del absolute_import, print_function, unicode_literals
import os import os
import gpg import gpg
import support import support
_ = support # to appease pyflakes.
expected_notations = { expected_notations = {
"laughing@me": ("Just Squeeze Me", gpg.constants.sig.notation.HUMAN_READABLE), "laughing@me": ("Just Squeeze Me", gpg.constants.sig.notation.HUMAN_READABLE),

View File

@ -22,6 +22,7 @@ del absolute_import, print_function, unicode_literals
import gpg import gpg
import support import support
_ = support # to appease pyflakes.
c = gpg.Context() c = gpg.Context()

View File

@ -24,6 +24,7 @@ import sys
import os import os
import gpg import gpg
import support import support
_ = support # to appease pyflakes.
test_text1 = b"Just GNU it!\n" test_text1 = b"Just GNU it!\n"
test_text1f= b"Just GNU it?\n" test_text1f= b"Just GNU it?\n"

View File

@ -23,6 +23,7 @@ del absolute_import, print_function, unicode_literals
import time import time
import gpg import gpg
import support import support
_ = support # to appease pyflakes.
c = gpg.Context() c = gpg.Context()
c.set_armor(True) c.set_armor(True)

View File

@ -18,6 +18,8 @@
# License along with this program; if not, see <http://www.gnu.org/licenses/>. # License along with this program; if not, see <http://www.gnu.org/licenses/>.
import gpg import gpg
import support
_ = support # to appease pyflakes.
d0 = gpg.Data() d0 = gpg.Data()
d0.seek # trigger on-demand-wrapping d0.seek # trigger on-demand-wrapping