summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRicharda Butler <39577672+RikkiButler20@users.noreply.github.com>2022-08-10 13:53:48 -0700
committerGitHub <noreply@github.com>2022-08-10 20:53:48 +0000
commitef818339db3490615f467f4d189a0e5da00eca62 (patch)
tree92551db7ffe6504fc213fa2dfde622ab2694741a /lib
parent98a540c793a3d90c875303ab07b14dcceb191b74 (diff)
downloadspack-ef818339db3490615f467f4d189a0e5da00eca62.tar.gz
spack-ef818339db3490615f467f4d189a0e5da00eca62.tar.bz2
spack-ef818339db3490615f467f4d189a0e5da00eca62.tar.xz
spack-ef818339db3490615f467f4d189a0e5da00eca62.zip
Update tests so /tmp/store can be accessed (#32003)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/test/bootstrap.py12
-rw-r--r--lib/spack/spack/test/cmd/env.py15
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