skip gpg tests when no gpg executable (#14935)
* skip gpg tests when no gpg executable * flake
This commit is contained in:
parent
f396106d1c
commit
82f76c44a0
@ -13,6 +13,7 @@
|
|||||||
import spack.paths as spack_paths
|
import spack.paths as spack_paths
|
||||||
import spack.spec as spec
|
import spack.spec as spec
|
||||||
import spack.util.web as web_util
|
import spack.util.web as web_util
|
||||||
|
import spack.util.gpg
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@ -41,6 +42,15 @@ def test_urlencode_string():
|
|||||||
assert(s_enc == 'Spack+Test+Project')
|
assert(s_enc == 'Spack+Test+Project')
|
||||||
|
|
||||||
|
|
||||||
|
def has_gpg():
|
||||||
|
try:
|
||||||
|
gpg = spack.util.gpg.Gpg.gpg()
|
||||||
|
except spack.util.gpg.SpackGPGError:
|
||||||
|
gpg = None
|
||||||
|
return bool(gpg)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not has_gpg(), reason='This test requires gpg')
|
||||||
def test_import_signing_key(mock_gnupghome):
|
def test_import_signing_key(mock_gnupghome):
|
||||||
signing_key_dir = spack_paths.mock_gpg_keys_path
|
signing_key_dir = spack_paths.mock_gpg_keys_path
|
||||||
signing_key_path = os.path.join(signing_key_dir, 'package-signing-key')
|
signing_key_path = os.path.join(signing_key_dir, 'package-signing-key')
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
from spack.test.conftest import MockPackage, MockPackageMultiRepo
|
from spack.test.conftest import MockPackage, MockPackageMultiRepo
|
||||||
import spack.util.executable as exe
|
import spack.util.executable as exe
|
||||||
import spack.util.spack_yaml as syaml
|
import spack.util.spack_yaml as syaml
|
||||||
|
import spack.util.gpg
|
||||||
|
|
||||||
|
|
||||||
ci_cmd = SpackCommand('ci')
|
ci_cmd = SpackCommand('ci')
|
||||||
@ -32,6 +33,14 @@
|
|||||||
git = exe.which('git', required=True)
|
git = exe.which('git', required=True)
|
||||||
|
|
||||||
|
|
||||||
|
def has_gpg():
|
||||||
|
try:
|
||||||
|
gpg = spack.util.gpg.Gpg.gpg()
|
||||||
|
except spack.util.gpg.SpackGPGError:
|
||||||
|
gpg = None
|
||||||
|
return bool(gpg)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
def env_deactivate():
|
def env_deactivate():
|
||||||
yield
|
yield
|
||||||
@ -494,6 +503,7 @@ def test_ci_pushyaml(tmpdir):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.disable_clean_stage_check
|
@pytest.mark.disable_clean_stage_check
|
||||||
|
@pytest.mark.skipif(not has_gpg(), reason='This test requires gpg')
|
||||||
def test_push_mirror_contents(tmpdir, mutable_mock_env_path, env_deactivate,
|
def test_push_mirror_contents(tmpdir, mutable_mock_env_path, env_deactivate,
|
||||||
install_mockery, mock_packages, mock_fetch,
|
install_mockery, mock_packages, mock_fetch,
|
||||||
mock_stage, mock_gnupghome):
|
mock_stage, mock_gnupghome):
|
||||||
|
@ -52,8 +52,16 @@ def test_no_gpg_in_path(tmpdir, mock_gnupghome, monkeypatch):
|
|||||||
spack.util.gpg.Gpg.gpg()
|
spack.util.gpg.Gpg.gpg()
|
||||||
|
|
||||||
|
|
||||||
|
def has_gpg():
|
||||||
|
try:
|
||||||
|
gpg = spack.util.gpg.Gpg.gpg()
|
||||||
|
except spack.util.gpg.SpackGPGError:
|
||||||
|
gpg = None
|
||||||
|
return bool(gpg)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.maybeslow
|
@pytest.mark.maybeslow
|
||||||
@pytest.mark.skipif(not spack.util.gpg.Gpg.gpg(),
|
@pytest.mark.skipif(not has_gpg(),
|
||||||
reason='These tests require gnupg2')
|
reason='These tests require gnupg2')
|
||||||
def test_gpg(tmpdir, mock_gnupghome):
|
def test_gpg(tmpdir, mock_gnupghome):
|
||||||
# Verify a file with an empty keyring.
|
# Verify a file with an empty keyring.
|
||||||
|
@ -31,6 +31,14 @@
|
|||||||
from spack.relocate import modify_macho_object, macho_get_paths
|
from spack.relocate import modify_macho_object, macho_get_paths
|
||||||
|
|
||||||
|
|
||||||
|
def has_gpg():
|
||||||
|
try:
|
||||||
|
gpg = spack.util.gpg.Gpg.gpg()
|
||||||
|
except spack.util.gpg.SpackGPGError:
|
||||||
|
gpg = None
|
||||||
|
return bool(gpg)
|
||||||
|
|
||||||
|
|
||||||
def fake_fetchify(url, pkg):
|
def fake_fetchify(url, pkg):
|
||||||
"""Fake the URL for a package so it downloads from a file."""
|
"""Fake the URL for a package so it downloads from a file."""
|
||||||
fetcher = FetchStrategyComposite()
|
fetcher = FetchStrategyComposite()
|
||||||
@ -38,6 +46,7 @@ def fake_fetchify(url, pkg):
|
|||||||
pkg.fetcher = fetcher
|
pkg.fetcher = fetcher
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not has_gpg(), reason='This test requires gpg')
|
||||||
@pytest.mark.usefixtures('install_mockery', 'mock_gnupghome')
|
@pytest.mark.usefixtures('install_mockery', 'mock_gnupghome')
|
||||||
def test_buildcache(mock_archive, tmpdir):
|
def test_buildcache(mock_archive, tmpdir):
|
||||||
# tweak patchelf to only do a download
|
# tweak patchelf to only do a download
|
||||||
|
Loading…
Reference in New Issue
Block a user