Fixed gpg_ver initialization in conftest.py.
It should be a global variable in order to be imported
This commit is contained in:
@@ -6,6 +6,11 @@ try:
|
|||||||
import gpg
|
import gpg
|
||||||
except ImportError:
|
except ImportError:
|
||||||
gpg = None
|
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 os
|
||||||
import sys
|
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)):
|
for fpath in iter(f for cg in clear_globs for f in glob.glob(cg)):
|
||||||
os.unlink(fpath)
|
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
|
# check that there are no keys loaded, now
|
||||||
with gpg.Context(offline=True) as c:
|
with gpg.Context(offline=True) as c:
|
||||||
c.set_engine_info(gpg.constants.PROTOCOL_OpenPGP, home_dir=gnupghome)
|
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
|
assert len(list(c.keylist(secret=True))) == 0
|
||||||
|
|
||||||
else:
|
else:
|
||||||
gpg_ver = 'unknown'
|
|
||||||
# we're not running integration tests
|
# we're not running integration tests
|
||||||
print("running without integration tests")
|
print("running without integration tests")
|
||||||
# if we're on GitHub CI, this is an error
|
# if we're on GitHub CI, this is an error
|
||||||
|
|||||||
Reference in New Issue
Block a user