Skip to content
Snippets Groups Projects

split one test into three

Merged Hans Fangohr requested to merge split-installation-tests into force-checking-of-error-code
1 file
+ 3
1
Compare changes
  • Side-by-side
  • Inline
+ 19
13
@@ -147,20 +147,19 @@ def test_setup_log_cmd(tmp_path):
@@ -147,20 +147,19 @@ def test_setup_log_cmd(tmp_path):
assert "Spack environments branch: dev-23a " in last_line
assert "Spack environments branch: dev-23a " in last_line
def test_install_environment(tmp_path):
def test_install_environment_wrong_toolchain(tmp_path):
"""Test the installation of a toolchain.
"""Test exception is raised for non-existing toolchain."""
# Expect an Exception when wrong toolchains are provided
This is a long test, its handy to test this with print statements printed to
stdout, use:
pytest -s
Expect an Exception when wrong toolchains are provided
"""
with pytest.raises(Exception):
with pytest.raises(Exception):
mod.install_environment(
mod.install_environment(
mpsd_release="dev-23a",
mpsd_release="dev-23a",
toolchains=["wrong-toolchain"],
toolchains=["wrong-toolchain"],
script_dir=(tmp_path),
script_dir=(tmp_path),
)
)
 
 
 
def test_install_environment_wrong_mpsd_release(tmp_path):
 
"""Test exception is raised for non-existing mpsd release."""
# Expect an Exception when wrong mpsd_release is provided (part of
# Expect an Exception when wrong mpsd_release is provided (part of
# prepare_environment)
# prepare_environment)
with pytest.raises(Exception):
with pytest.raises(Exception):
@@ -169,11 +168,18 @@ def test_install_environment(tmp_path):
@@ -169,11 +168,18 @@ def test_install_environment(tmp_path):
toolchains=["foss2021a-mpi"],
toolchains=["foss2021a-mpi"],
script_dir=(tmp_path),
script_dir=(tmp_path),
)
)
# prepare a test of global generic with only zlib to test the installation
# prepare dev-23a release
# script_dir = tmp_path / "test_global_generic"
def test_install_environment_zlib():
# for actaual installation avoid tmp_path as the lenght of the path is too long
"""Test installation of toolchain."""
# and spack complains
# Prepare a test installation of global generic
 
# with only zlib to test the installation
 
# This is a long test,
 
# its handy to test this with print statements printed to
 
# stdout, use:
 
# pytest -s
 
# for this installation avoid tmp_path as
 
# the length of the path becomes too long and spack complains
script_dir = Path("/tmp/test_global_generic")
script_dir = Path("/tmp/test_global_generic")
if script_dir.exists():
if script_dir.exists():
shutil.rmtree(script_dir)
shutil.rmtree(script_dir)
Loading