summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/test/git_fetch.py5
-rw-r--r--lib/spack/spack/test/hg_fetch.py5
-rw-r--r--lib/spack/spack/test/mirror.py33
-rw-r--r--lib/spack/spack/test/svn_fetch.py5
4 files changed, 39 insertions, 9 deletions
diff --git a/lib/spack/spack/test/git_fetch.py b/lib/spack/spack/test/git_fetch.py
index 34f74df84f..093f0a7053 100644
--- a/lib/spack/spack/test/git_fetch.py
+++ b/lib/spack/spack/test/git_fetch.py
@@ -29,6 +29,11 @@ import spack
from llnl.util.filesystem import *
from spack.spec import Spec
from spack.version import ver
+from spack.util.executable import which
+
+
+pytestmark = pytest.mark.skipif(
+ not which('git'), reason='requires git to be installed')
@pytest.mark.parametrize("type_of_test", ['master', 'branch', 'tag', 'commit'])
diff --git a/lib/spack/spack/test/hg_fetch.py b/lib/spack/spack/test/hg_fetch.py
index 96a23a1c53..c0318c58ff 100644
--- a/lib/spack/spack/test/hg_fetch.py
+++ b/lib/spack/spack/test/hg_fetch.py
@@ -29,6 +29,11 @@ import spack
from llnl.util.filesystem import *
from spack.spec import Spec
from spack.version import ver
+from spack.util.executable import which
+
+
+pytestmark = pytest.mark.skipif(
+ not which('hg'), reason='requires mercurial to be installed')
@pytest.mark.parametrize("type_of_test", ['default', 'rev0'])
diff --git a/lib/spack/spack/test/mirror.py b/lib/spack/spack/test/mirror.py
index e5e60e3045..21dbb8f4f6 100644
--- a/lib/spack/spack/test/mirror.py
+++ b/lib/spack/spack/test/mirror.py
@@ -26,18 +26,20 @@ import filecmp
import os
import pytest
+from llnl.util.filesystem import join_path
+
import spack
import spack.mirror
import spack.util.executable
-from llnl.util.filesystem import join_path
from spack.spec import Spec
from spack.stage import Stage
+from spack.util.executable import which
# paths in repos that shouldn't be in the mirror tarballs.
exclude = ['.hg', '.git', '.svn']
+
repos = {}
-svn = spack.util.executable.which('svn', required=True)
def set_up_package(name, repository, url_attr):
@@ -95,13 +97,17 @@ def check_mirror():
# Stage the archive from the mirror and cd to it.
spack.do_checksum = False
pkg.do_stage(mirror_only=True)
+
# Compare the original repo with the expanded archive
original_path = mock_repo.path
if 'svn' in name:
# have to check out the svn repo to compare.
original_path = join_path(
mock_repo.path, 'checked_out')
+
+ svn = which('svn', required=True)
svn('checkout', mock_repo.url, original_path)
+
dcmp = filecmp.dircmp(original_path, pkg.stage.source_path)
# make sure there are no new files in the expanded
# tarball
@@ -113,33 +119,42 @@ def check_mirror():
@pytest.mark.usefixtures('config', 'refresh_builtin_mock')
class TestMirror(object):
+ def test_url_mirror(self, mock_archive):
+ set_up_package('trivial-install-test-package', mock_archive, 'url')
+ check_mirror()
+ repos.clear()
+
+ @pytest.mark.skipif(
+ not which('git'), reason='requires git to be installed')
def test_git_mirror(self, mock_git_repository):
set_up_package('git-test', mock_git_repository, 'git')
check_mirror()
repos.clear()
+ @pytest.mark.skipif(
+ not which('svn'), reason='requires subversion to be installed')
def test_svn_mirror(self, mock_svn_repository):
set_up_package('svn-test', mock_svn_repository, 'svn')
check_mirror()
repos.clear()
+ @pytest.mark.skipif(
+ not which('hg'), reason='requires mercurial to be installed')
def test_hg_mirror(self, mock_hg_repository):
set_up_package('hg-test', mock_hg_repository, 'hg')
check_mirror()
repos.clear()
- def test_url_mirror(self, mock_archive):
- set_up_package('trivial-install-test-package', mock_archive, 'url')
- check_mirror()
- repos.clear()
-
+ @pytest.mark.skipif(
+ not all([which('svn'), which('hg'), which('git')]),
+ reason='requires subversion, git, and mercurial to be installed')
def test_all_mirror(
self,
mock_git_repository,
mock_svn_repository,
mock_hg_repository,
- mock_archive,
- ):
+ mock_archive):
+
set_up_package('git-test', mock_git_repository, 'git')
set_up_package('svn-test', mock_svn_repository, 'svn')
set_up_package('hg-test', mock_hg_repository, 'hg')
diff --git a/lib/spack/spack/test/svn_fetch.py b/lib/spack/spack/test/svn_fetch.py
index 2ffedee7db..1a7cc3ecd1 100644
--- a/lib/spack/spack/test/svn_fetch.py
+++ b/lib/spack/spack/test/svn_fetch.py
@@ -29,6 +29,11 @@ import spack
from llnl.util.filesystem import *
from spack.spec import Spec
from spack.version import ver
+from spack.util.executable import which
+
+
+pytestmark = pytest.mark.skipif(
+ not which('svn'), reason='requires subversion to be installed')
@pytest.mark.parametrize("type_of_test", ['default', 'rev0'])