summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-07-22 20:04:01 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2018-07-25 23:10:10 -0700
commit5f00056490665ef6ddd7389966480bca7d2f3a04 (patch)
tree7f2cfc522852711c578df88b139d1bcee47e78f9 /lib
parent020c34e13665c508d5afe13da52042d791d22367 (diff)
downloadspack-5f00056490665ef6ddd7389966480bca7d2f3a04.tar.gz
spack-5f00056490665ef6ddd7389966480bca7d2f3a04.tar.bz2
spack-5f00056490665ef6ddd7389966480bca7d2f3a04.tar.xz
spack-5f00056490665ef6ddd7389966480bca7d2f3a04.zip
tests: convert mirror test to pytest with free functions.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/test/mirror.py91
1 files changed, 47 insertions, 44 deletions
diff --git a/lib/spack/spack/test/mirror.py b/lib/spack/spack/test/mirror.py
index 2df15c1486..998f4e2053 100644
--- a/lib/spack/spack/test/mirror.py
+++ b/lib/spack/spack/test/mirror.py
@@ -33,6 +33,8 @@ from spack.spec import Spec
from spack.stage import Stage
from spack.util.executable import which
+pytestmark = pytest.mark.usefixtures('config', 'mutable_mock_packages')
+
# paths in repos that shouldn't be in the mirror tarballs.
exclude = ['.hg', '.git', '.svn']
@@ -110,47 +112,48 @@ def check_mirror():
assert all(l in exclude for l in dcmp.left_only)
-@pytest.mark.usefixtures('config', 'mutable_mock_packages')
-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()
-
- @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):
-
- 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')
- set_up_package('trivial-install-test-package', mock_archive, 'url')
- check_mirror()
- repos.clear()
+def test_url_mirror(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(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(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(mock_hg_repository):
+ set_up_package('hg-test', mock_hg_repository, 'hg')
+ 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(
+ mock_git_repository,
+ mock_svn_repository,
+ mock_hg_repository,
+ 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')
+ set_up_package('trivial-install-test-package', mock_archive, 'url')
+ check_mirror()
+ repos.clear()