spack/lib/spack/spack/test/config_values.py
Greg Becker e7c591a8b8
Deprecate Spec.concretize/Spec.concretized in favor of spack.concretize.concretize_one (#47971)
The methods spack.spec.Spec.concretize and spack.spec.Spec.concretized
are deprecated in favor of spack.concretize.concretize_one.

This will resolve a circular dependency between the spack.spec and
spack.concretize in the next Spack release.
2025-01-15 10:13:19 +01:00

30 lines
1.0 KiB
Python

# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import pytest
import spack.concretize
import spack.store
@pytest.mark.parametrize("hash_length", [1, 2, 3, 4, 5, 9])
@pytest.mark.usefixtures("mock_packages")
def test_set_install_hash_length(hash_length, mutable_config, tmpdir):
mutable_config.set("config:install_hash_length", hash_length)
with spack.store.use_store(str(tmpdir)):
spec = spack.concretize.concretize_one("libelf")
prefix = spec.prefix
hash_str = prefix.rsplit("-")[-1]
assert len(hash_str) == hash_length
@pytest.mark.usefixtures("mock_packages")
def test_set_install_hash_length_upper_case(mutable_config, tmpdir):
mutable_config.set("config:install_hash_length", 5)
with spack.store.use_store(str(tmpdir), extra_data={"projections": {"all": "{name}-{HASH}"}}):
spec = spack.concretize.concretize_one("libelf")
prefix = spec.prefix
hash_str = prefix.rsplit("-")[-1]
assert len(hash_str) == 5