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

first attempt at adding tests

parent 9533dcc1
No related branches found
No related tags found
1 merge request!41Status command
Pipeline #370481 failed
......@@ -843,7 +843,7 @@ def environment_status(mpsd_release, script_dir):
f"Release {mpsd_release} has not been completly installed yet"
", try reinstalling it (spack directory not found)"
)
return
return None
# find all folders for all microarch in the release directory
# except for the blacklisted files
black_listed_files = [
......@@ -873,6 +873,7 @@ def environment_status(mpsd_release, script_dir):
plog.info(f"- {microarch}: \n \t {toolchains}")
return toolchain_map
def main():
"""Execute main entry point."""
parser = argparse.ArgumentParser(description=about_tool)
......
......@@ -424,6 +424,28 @@ def test_create_log_file_names():
assert build_log_file_name is None
def test_environment_status(tmp_path):
"""Test that the environment status is correct."""
toolchain_map = mod.environment_status("fake-release", tmp_path)
assert toolchain_map is None
# create a fake environment
mpsd_release = "dev-23a"
mpsd_microarch = "sandybridge"
expected_toochain_map = {"sandybridge": ["foss2021a", "intel2021a"]}
for mpsd_release in expected_toochain_map.keys():
toolchain_files_path = (
tmp_path / mpsd_release / mpsd_microarch / "lmod" / "Core" / "toolchains"
)
toolchain_files_path.mkdir(parents=True)
for toolchain in expected_toochain_map[mpsd_release]:
toolchain_file = toolchain_files_path / f"{toolchain}.lua"
toolchain_file.touch()
# check that the environment status is correct
toolchain_map = mod.environment_status(mpsd_release, tmp_path)
assert toolchain_map == expected_toochain_map
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.
Please register or to comment