summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/test/ci.py10
-rw-r--r--lib/spack/spack/test/cmd/ci.py10
-rw-r--r--lib/spack/spack/test/cmd/gpg.py10
-rw-r--r--lib/spack/spack/test/packaging.py9
4 files changed, 38 insertions, 1 deletions
diff --git a/lib/spack/spack/test/ci.py b/lib/spack/spack/test/ci.py
index 3143a938c2..a153437ffa 100644
--- a/lib/spack/spack/test/ci.py
+++ b/lib/spack/spack/test/ci.py
@@ -13,6 +13,7 @@ import spack.config as cfg
import spack.paths as spack_paths
import spack.spec as spec
import spack.util.web as web_util
+import spack.util.gpg
@pytest.fixture
@@ -41,6 +42,15 @@ def test_urlencode_string():
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):
signing_key_dir = spack_paths.mock_gpg_keys_path
signing_key_path = os.path.join(signing_key_dir, 'package-signing-key')
diff --git a/lib/spack/spack/test/cmd/ci.py b/lib/spack/spack/test/cmd/ci.py
index 49663b3409..89ed471868 100644
--- a/lib/spack/spack/test/cmd/ci.py
+++ b/lib/spack/spack/test/cmd/ci.py
@@ -21,6 +21,7 @@ from spack.spec import Spec
from spack.test.conftest import MockPackage, MockPackageMultiRepo
import spack.util.executable as exe
import spack.util.spack_yaml as syaml
+import spack.util.gpg
ci_cmd = SpackCommand('ci')
@@ -32,6 +33,14 @@ buildcache_cmd = SpackCommand('buildcache')
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()
def env_deactivate():
yield
@@ -494,6 +503,7 @@ def test_ci_pushyaml(tmpdir):
@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,
install_mockery, mock_packages, mock_fetch,
mock_stage, mock_gnupghome):
diff --git a/lib/spack/spack/test/cmd/gpg.py b/lib/spack/spack/test/cmd/gpg.py
index 4333a38fe2..56d178f449 100644
--- a/lib/spack/spack/test/cmd/gpg.py
+++ b/lib/spack/spack/test/cmd/gpg.py
@@ -52,8 +52,16 @@ def test_no_gpg_in_path(tmpdir, mock_gnupghome, monkeypatch):
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.skipif(not spack.util.gpg.Gpg.gpg(),
+@pytest.mark.skipif(not has_gpg(),
reason='These tests require gnupg2')
def test_gpg(tmpdir, mock_gnupghome):
# Verify a file with an empty keyring.
diff --git a/lib/spack/spack/test/packaging.py b/lib/spack/spack/test/packaging.py
index 8f11b8ec99..39d12df7b7 100644
--- a/lib/spack/spack/test/packaging.py
+++ b/lib/spack/spack/test/packaging.py
@@ -31,6 +31,14 @@ from spack.relocate import macho_replace_paths, macho_make_paths_relative
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):
"""Fake the URL for a package so it downloads from a file."""
fetcher = FetchStrategyComposite()
@@ -38,6 +46,7 @@ def fake_fetchify(url, pkg):
pkg.fetcher = fetcher
+@pytest.mark.skipif(not has_gpg(), reason='This test requires gpg')
@pytest.mark.usefixtures('install_mockery', 'mock_gnupghome')
def test_buildcache(mock_archive, tmpdir):
# tweak patchelf to only do a download