unit-test: make Spec.compiler behavior stricter
Now the adaptor will raise if the Spec has no C, C++, or Fortran compiler.
This commit is contained in:
parent
3a67dfd9e8
commit
7f093d129b
@ -306,7 +306,6 @@ def test_package_test_no_compilers(mock_packages, monkeypatch, capfd):
|
|||||||
pkg.do_test()
|
pkg.do_test()
|
||||||
error = capfd.readouterr()[1]
|
error = capfd.readouterr()[1]
|
||||||
assert "Skipping tests for package" in error
|
assert "Skipping tests for package" in error
|
||||||
assert "test requires missing compiler" in error
|
|
||||||
|
|
||||||
|
|
||||||
def test_package_subscript(default_mock_concretization):
|
def test_package_subscript(default_mock_concretization):
|
||||||
|
@ -2044,3 +2044,22 @@ def test_satisfies_and_subscript_with_compilers(default_mock_concretization):
|
|||||||
|
|
||||||
# We need to pass through "pkg-a" to get "gmake" with [] notation
|
# We need to pass through "pkg-a" to get "gmake" with [] notation
|
||||||
assert s["pkg-a"].dependencies(name="gmake")[0] == s["pkg-a"]["gmake"]
|
assert s["pkg-a"].dependencies(name="gmake")[0] == s["pkg-a"]["gmake"]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"spec_str,spec_fmt,expected",
|
||||||
|
[
|
||||||
|
# Depends on C
|
||||||
|
("mpileaks", "{name}-{compiler.name}", "mpileaks-gcc"),
|
||||||
|
("mpileaks", "{name}-{compiler.name}-{compiler.version}", "mpileaks-gcc-10.2.1"),
|
||||||
|
# No compiler
|
||||||
|
("pkg-c", "{name}-{compiler.name}", "pkg-c-none"),
|
||||||
|
("pkg-c", "{name}-{compiler.name}-{compiler.version}", "pkg-c-none-none"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_spec_format_with_compiler_adaptors(
|
||||||
|
spec_str, spec_fmt, expected, default_mock_concretization
|
||||||
|
):
|
||||||
|
"""Tests the output of spec format, when involving `Spec.compiler` adaptors"""
|
||||||
|
s = default_mock_concretization(spec_str)
|
||||||
|
assert s.format(spec_fmt) == expected
|
||||||
|
Loading…
Reference in New Issue
Block a user