diff options
author | Axel Huebl <axel.huebl@plasma.ninja> | 2020-04-15 10:18:17 -0700 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2020-04-15 11:44:14 -0700 |
commit | e1e804168a4578e47ce3917ce9fa8ba60aebd504 (patch) | |
tree | 8f416913db72291589d5d3a3557e5292a7de5288 /lib | |
parent | 7e5257e44af139a9d9150496d81cc1c8aacb2769 (diff) | |
download | spack-e1e804168a4578e47ce3917ce9fa8ba60aebd504.tar.gz spack-e1e804168a4578e47ce3917ce9fa8ba60aebd504.tar.bz2 spack-e1e804168a4578e47ce3917ce9fa8ba60aebd504.tar.xz spack-e1e804168a4578e47ce3917ce9fa8ba60aebd504.zip |
Tests: Mirror Mixin Classes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/test/build_systems.py | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/lib/spack/spack/test/build_systems.py b/lib/spack/spack/test/build_systems.py index 7ede78b7a5..295704798f 100644 --- a/lib/spack/spack/test/build_systems.py +++ b/lib/spack/spack/test/build_systems.py @@ -219,3 +219,72 @@ class TestCMakePackage(object): with pytest.raises(KeyError, match="not a variant"): pkg.define_from_variant('NONEXISTENT') + + +@pytest.mark.usefixtures('config', 'mock_packages') +class TestGNUMirrorPackage(object): + + def test_define(self): + s = Spec('mirror-gnu') + s.concretize() + pkg = spack.repo.get(s) + + s = Spec('mirror-gnu-broken') + s.concretize() + pkg_broken = spack.repo.get(s) + + cls_name = type(pkg_broken).__name__ + with pytest.raises(AttributeError, + match=r'{0} must define a `gnu_mirror_path` ' + r'attribute \[none defined\]' + .format(cls_name)): + pkg_broken.urls + + assert pkg.urls[0] == 'https://ftpmirror.gnu.org/' \ + 'make/make-4.2.1.tar.gz' + + +@pytest.mark.usefixtures('config', 'mock_packages') +class TestSourcewarePackage(object): + + def test_define(self): + s = Spec('mirror-sourceware') + s.concretize() + pkg = spack.repo.get(s) + + s = Spec('mirror-sourceware-broken') + s.concretize() + pkg_broken = spack.repo.get(s) + + cls_name = type(pkg_broken).__name__ + with pytest.raises(AttributeError, + match=r'{0} must define a `sourceware_mirror_path` ' + r'attribute \[none defined\]' + .format(cls_name)): + pkg_broken.urls + + assert pkg.urls[0] == 'https://sourceware.org/pub/' \ + 'bzip2/bzip2-1.0.8.tar.gz' + + +@pytest.mark.usefixtures('config', 'mock_packages') +class TestXorgPackage(object): + + def test_define(self): + s = Spec('mirror-xorg') + s.concretize() + pkg = spack.repo.get(s) + + s = Spec('mirror-xorg-broken') + s.concretize() + pkg_broken = spack.repo.get(s) + + cls_name = type(pkg_broken).__name__ + with pytest.raises(AttributeError, + match=r'{0} must define a `xorg_mirror_path` ' + r'attribute \[none defined\]' + .format(cls_name)): + pkg_broken.urls + + assert pkg.urls[0] == 'https://www.x.org/archive/individual/' \ + 'util/util-macros-1.19.1.tar.bz2' |