Fixed gpg_ver initialization in conftest.py.

It should be a global variable in order to be imported
This commit is contained in:
KOLANICH
2022-11-03 13:12:02 +03:00
parent b5cc2f353b
commit d0cea0a4e1

View File

@@ -6,6 +6,11 @@ try:
import gpg
except ImportError:
gpg = None
gpg_ver = 'unknown'
else:
# get the GnuPG version
gpg_ver = list(filter(lambda x: x.protocol == gpg.constants.PROTOCOL_OpenPGP, gpg.core.get_engine_info()))[0].version
import os
import sys
@@ -45,9 +50,6 @@ def pytest_configure(config):
for fpath in iter(f for cg in clear_globs for f in glob.glob(cg)):
os.unlink(fpath)
# get the GnuPG version
gpg_ver = list(filter(lambda x: x.protocol == gpg.constants.PROTOCOL_OpenPGP, gpg.core.get_engine_info()))[0].version
# check that there are no keys loaded, now
with gpg.Context(offline=True) as c:
c.set_engine_info(gpg.constants.PROTOCOL_OpenPGP, home_dir=gnupghome)
@@ -56,7 +58,6 @@ def pytest_configure(config):
assert len(list(c.keylist(secret=True))) == 0
else:
gpg_ver = 'unknown'
# we're not running integration tests
print("running without integration tests")
# if we're on GitHub CI, this is an error