Skip to content
Snippets Groups Projects
Commit 6013d566 authored by Ashwin Kumar Karnad's avatar Ashwin Kumar Karnad
Browse files

add test_remove_global_package_sets

parent 99b2b5a8
No related branches found
No related tags found
1 merge request!82Remove cmd
Pipeline #384203 passed
......@@ -257,7 +257,7 @@ def test_install_environment_zlib():
with open(
package_set_src_dir / "global_generic" / "global_packages.list", "w"
) as f:
f.write("zlib@1.2.13 \n")
f.write("zlib@1.2.13 \nzstd@1.5.2\n")
# add zlib to whitelist of module creation file by replacing anaconda3%gcc@10.2.1
# with zlib@1.2.13
......@@ -791,6 +791,49 @@ def test_remove_package_sets(tmp_path, simple_toolchain):
)
def test_remove_global_package_sets():
"""Test removal of global package_sets via spack."""
root_dir = Path("/tmp/test_global_generic")
if not root_dir.exists():
# we need the sample spack instance with global_generic
# this is already done in test_install_environment_zlib
# so we just need to call it
test_install_environment_zlib()
# check that zlib and zstd are installed
spack_dir = root_dir / "dev-23a" / mod.get_native_microarchitecture() / "spack"
source_spack = (
f"export SPACK_DIR={spack_dir} &&"
f'. {spack_dir / "share" / "spack" / "setup-env.sh"}'
)
# check that zlib is installed
# location commands exits with non zero if not installed thus
# breaking failing test
mod.run(f"{source_spack} && spack location -i zlib", shell=True, check=True)
# check that zstd is installed
mod.run(f"{source_spack} && spack location -i zstd", shell=True, check=True)
# remove global_generic
mod.remove_environment(
mpsd_release="dev-23a",
root_dir=root_dir,
package_sets=["global_generic"],
force_remove=True,
)
# check that zstd@1.5 is not installed
# we are here flipping the exit code to check that it is not installed
mod.run(
f"{source_spack} && (spack location -i zstd && exit 1 || exit 0 )",
shell=True,
check=True,
)
# check that zlib is not installed
mod.run(
f"{source_spack} && (spack location -i zlib && exit 1 || exit 0 )",
shell=True,
check=True,
)
def test_interface(tmp_path):
"""Test other things (not implemented yet)."""
pass
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment