From ef818339db3490615f467f4d189a0e5da00eca62 Mon Sep 17 00:00:00 2001 From: Richarda Butler <39577672+RikkiButler20@users.noreply.github.com> Date: Wed, 10 Aug 2022 13:53:48 -0700 Subject: Update tests so /tmp/store can be accessed (#32003) --- lib/spack/spack/test/bootstrap.py | 12 +++++++----- lib/spack/spack/test/cmd/env.py | 15 +++++++-------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/spack/spack/test/bootstrap.py b/lib/spack/spack/test/bootstrap.py index 7170a4b791..aeacf99d76 100644 --- a/lib/spack/spack/test/bootstrap.py +++ b/lib/spack/spack/test/bootstrap.py @@ -2,7 +2,6 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -import os import sys import pytest @@ -139,6 +138,7 @@ def test_custom_store_in_environment(mutable_config, tmpdir): # Test that the custom store in an environment is taken into account # during bootstrapping spack_yaml = tmpdir.join("spack.yaml") + install_root = tmpdir.join("store") spack_yaml.write( """ spack: @@ -146,16 +146,18 @@ spack: - libelf config: install_tree: - root: /tmp/store -""" + root: {0} +""".format( + install_root + ) ) with spack.environment.Environment(str(tmpdir)): assert spack.environment.active_environment() - assert spack.config.get("config:install_tree:root") == "/tmp/store" + assert spack.config.get("config:install_tree:root") == install_root # Don't trigger evaluation here with spack.bootstrap.ensure_bootstrap_configuration(): pass - assert str(spack.store.root) == os.sep + os.path.join("tmp", "store") + assert str(spack.store.root) == install_root def test_nested_use_of_context_manager(mutable_config): diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py index 978ff987da..4bb7203be7 100644 --- a/lib/spack/spack/test/cmd/env.py +++ b/lib/spack/spack/test/cmd/env.py @@ -2729,6 +2729,7 @@ def test_activation_and_deactiviation_ambiguities(method, env, no_env, env_dir, @pytest.mark.regression("26548") def test_custom_store_in_environment(mutable_config, tmpdir): spack_yaml = tmpdir.join("spack.yaml") + install_root = tmpdir.join("store") spack_yaml.write( """ spack: @@ -2736,17 +2737,15 @@ spack: - libelf config: install_tree: - root: /tmp/store -""" + root: {0} +""".format( + install_root + ) ) - if sys.platform == "win32": - sep = "\\" - else: - sep = "/" current_store_root = str(spack.store.root) - assert str(current_store_root) != sep + os.path.join("tmp", "store") + assert str(current_store_root) != install_root with spack.environment.Environment(str(tmpdir)): - assert str(spack.store.root) == sep + os.path.join("tmp", "store") + assert str(spack.store.root) == install_root assert str(spack.store.root) == current_store_root -- cgit v1.2.3-60-g2f50