Skip to content
Snippets Groups Projects
Commit f9ee635e authored by Hans Fangohr's avatar Hans Fangohr
Browse files

make pydocstyle pass

parent 28a8d969
No related branches found
No related tags found
2 merge requests!19Move linux-debian11 into main,!15Include Pydocstyle into CI
Pipeline #368457 passed
"""Tests for mpsd-software-environment.py."""
import importlib
import os
import shutil
......@@ -10,7 +12,7 @@ mod = importlib.import_module("mpsd-software-environment")
def test_os_chdir(tmp_path):
# create a temporary directory for testing
"""Create a temporary directory for testing."""
temp_dir = tmp_path / "test_os_chdir"
temp_dir.mkdir()
......@@ -26,11 +28,13 @@ def test_os_chdir(tmp_path):
def test_prepare_environment(tmp_path):
# simulate running ./install-software-environment.py --release dev-23a \
# --target-directory /tmp/test_prepare_env
# prepare_env is run when cmd is not specified, we can test cmd='prepare'
# and cmd=None to check both cases
"""Simulate running preparation of environment.
Simulate running ./install-software-environment.py --release dev-23a \
--target-directory /tmp/test_prepare_env
prepare_env is run when cmd is not specified, we can test cmd='prepare'
and cmd=None to check both cases
"""
script_dir = tmp_path / "test_prepare_env"
spack_environments = "spack-environments"
mpsd_release_to_test = "dev-23a"
......@@ -71,7 +75,10 @@ def test_prepare_environment(tmp_path):
def test_setup_log_cmd(tmp_path):
# check that logs/install-software-environment.log is updated when the module is run
"""Check that log is updated.
Check that logs/install-software-environment.log is updated when the module is run
"""
log_file = "install.log"
script_dir = tmp_path / "test_prepare_env"
......@@ -96,11 +103,13 @@ def test_setup_log_cmd(tmp_path):
def test_install_environment(tmp_path):
# Test the installation part
# 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
"""Test the installation of a toolchain.
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):
mod.install_environment(
mpsd_release="dev-23a",
......@@ -213,6 +222,7 @@ def test_install_environment(tmp_path):
def test_interface(tmp_path):
"""Test other things (not implemented yet)."""
pass
# ensure that installing without toolchains only passes the available toolchains
# check that the script branch and hash are correct when running the script
......
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