1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import pytest
from spack.main import SpackCommand
providers = SpackCommand("providers")
pytestmark = pytest.mark.not_on_windows("Providers not currently supported on Windows")
@pytest.mark.parametrize(
"pkg",
[("mpi",), ("mpi@2",), ("mpi", "lapack"), ("",)], # Lists all the available virtual packages
)
def test_it_just_runs(pkg):
providers(*pkg)
@pytest.mark.parametrize(
"vpkg,provider_list",
[
(
("mpi",),
[
"intel-mpi",
"intel-parallel-studio",
"mpich",
"mpilander",
"mvapich2",
"openmpi",
"openmpi@1.6.5",
"openmpi@1.7.5:",
"openmpi@2.0.0:",
"spectrum-mpi",
],
),
(("D", "awk"), ["ldc", "gawk", "mawk"]), # Call 2 virtual packages at once
],
)
def test_provider_lists(vpkg, provider_list):
output = providers(*vpkg)
for item in provider_list:
assert item in output
@pytest.mark.parametrize(
"pkg,error_cls",
[
("zlib", ValueError),
("foo", ValueError), # Trying to call with a package that does not exist
],
)
def test_it_just_fails(pkg, error_cls):
with pytest.raises(error_cls):
providers(pkg)
|