Skip to content
Snippets Groups Projects

allow CI to fail if ruff or black is unhappy, and format source to make it pass

Merged Hans Fangohr requested to merge activate-style-checks-in-ci into linux-debian11
All threads resolved!
1 file
+ 14
7
Compare changes
  • Side-by-side
  • Inline
+ 14
7
@@ -25,8 +25,10 @@ def test_os_chdir(tmp_path):
@@ -25,8 +25,10 @@ def test_os_chdir(tmp_path):
def test_prepare_environment(tmp_path):
def test_prepare_environment(tmp_path):
# simulate running ./install-software-environment.py --release dev-23a --target-directory /tmp/test_prepare_env
# simulate running ./install-software-environment.py --release dev-23a \
# prepare_env is run when cmd is not specified, we can test cmd='prepare' and cmd=None to check both cases
# --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"
script_dir = tmp_path / "test_prepare_env"
spack_environments = "spack-environments"
spack_environments = "spack-environments"
@@ -94,7 +96,8 @@ def test_setup_log_cmd(tmp_path):
@@ -94,7 +96,8 @@ def test_setup_log_cmd(tmp_path):
def test_install_environment(tmp_path):
def test_install_environment(tmp_path):
# Test the installation part
# Test the installation part
# This is a long test, its handy to test this with print statements printed to stdout, use:
# This is a long test, its handy to test this with print statements printed to
 
# stdout, use:
# pytest -s
# pytest -s
# Expect an Exception when wrong toolchains are provided
# Expect an Exception when wrong toolchains are provided
with pytest.raises(Exception):
with pytest.raises(Exception):
@@ -103,7 +106,8 @@ def test_install_environment(tmp_path):
@@ -103,7 +106,8 @@ def test_install_environment(tmp_path):
toolchains=["wrong-toolchain"],
toolchains=["wrong-toolchain"],
script_dir=(tmp_path),
script_dir=(tmp_path),
)
)
# Expect an Exception when wrong mpsd_release is provided ( part of prepare_environment)
# Expect an Exception when wrong mpsd_release is provided (part of
 
# prepare_environment)
with pytest.raises(Exception):
with pytest.raises(Exception):
mod.install_environment(
mod.install_environment(
mpsd_release="wrong-mpsd-release",
mpsd_release="wrong-mpsd-release",
@@ -113,7 +117,8 @@ def test_install_environment(tmp_path):
@@ -113,7 +117,8 @@ def test_install_environment(tmp_path):
# prepare a test of global generic with only zlib to test the installation
# prepare a test of global generic with only zlib to test the installation
# prepare dev-23a release
# prepare dev-23a release
# script_dir = tmp_path / "test_global_generic"
# script_dir = tmp_path / "test_global_generic"
# for actaual installation avoid tmp_path as the lenght of the path is too long and spack complains
# for actaual installation avoid tmp_path as the lenght of the path is 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)
@@ -134,7 +139,8 @@ def test_install_environment(tmp_path):
@@ -134,7 +139,8 @@ def test_install_environment(tmp_path):
with open(toolchain_src_dir / "global_generic" / "global_packages.list", "w") as f:
with open(toolchain_src_dir / "global_generic" / "global_packages.list", "w") as f:
f.write("zlib@1.2.13 \n")
f.write("zlib@1.2.13 \n")
# add zlib to whitelist of module creation file by replacing anaconda3%gcc@10.2.1 with zlib@1.2.13
# add zlib to whitelist of module creation file by replacing anaconda3%gcc@10.2.1
 
# with zlib@1.2.13
# in release_base_dir / "spack-environments/spack_overlay/etc/spack/modules.yaml"
# in release_base_dir / "spack-environments/spack_overlay/etc/spack/modules.yaml"
module_file = (
module_file = (
release_base_dir / "spack-environments/spack_overlay/etc/spack/modules.yaml"
release_base_dir / "spack-environments/spack_overlay/etc/spack/modules.yaml"
@@ -165,7 +171,8 @@ def test_install_environment(tmp_path):
@@ -165,7 +171,8 @@ def test_install_environment(tmp_path):
enable_build_cache=False,
enable_build_cache=False,
)
)
# test that the build log is created correctly
# test that the build log is created correctly
# check that a file with glob build_globale_generic_dev-23a*.log exists at release_base_dir/mpsd_microarch
# check that a file with glob build_globale_generic_dev-23a*.log exists at
 
# release_base_dir/mpsd_microarch
# print("Debug here ")
# print("Debug here ")
# time.sleep(10)
# time.sleep(10)
build_log = list(
build_log = list(
Loading