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

fix typo and tests

parent 790ea004
No related branches found
No related tags found
2 merge requests!39Split logfile templates usage,!29Restructure log location
Pipeline #370250 failed
This commit is part of merge request !29. Comments created here will be created in the context of that merge request.
...@@ -101,6 +101,7 @@ def create_log_file_names( ...@@ -101,6 +101,7 @@ def create_log_file_names(
log_template = config_vars["installer_log_template"] log_template = config_vars["installer_log_template"]
return log_template.substitute( return log_template.substitute(
mpsd_release=mpsd_release,
mpsd_microarch=mpsd_microarch, mpsd_microarch=mpsd_microarch,
date=date, date=date,
action=action, action=action,
......
...@@ -383,51 +383,46 @@ def test_metadata_logging(tmp_path): ...@@ -383,51 +383,46 @@ def test_metadata_logging(tmp_path):
assert len(read_dict) == len(keys) assert len(read_dict) == len(keys)
@pytest.mark.skip(
reason="This function is redundant in the next version of the script."
)
def test_create_log_file_names(): def test_create_log_file_names():
"""Test that the log file names are created correctly.""" """Test that the log file names are created correctly."""
pass
create_log_file_names = mod.create_log_file_names create_log_file_names = mod.create_log_file_names
mpsd_release = "dev-23a" mpsd_release = "dev-23a"
mpsd_microarch = "sandybridge" mpsd_microarch = "sandybridge"
date = datetime.datetime.now().replace(microsecond=0).isoformat() date = datetime.datetime.now().replace(microsecond=0).isoformat()
action = "install" action = "install"
toolchain = "foss2021a" toolchain = "foss2021a"
# test for correct action and toolchain # test build_log_file_name generation
installer_log_file, build_log_file = create_log_file_names( build_log_file_name = create_log_file_names(
mpsd_microarch=mpsd_microarch, mpsd_microarch=mpsd_microarch,
mpsd_release=mpsd_release, mpsd_release=mpsd_release,
date=date, date=date,
action=action, action=action,
toolchain=toolchain, toolchain=toolchain,
) )
assert installer_log_file == f"{mpsd_release}_{mpsd_microarch}_{date}_{action}.log"
assert ( assert (
build_log_file build_log_file_name
== f"{mpsd_release}_{mpsd_microarch}_{date}_{toolchain}_{action}.log" == f"{mpsd_release}_{mpsd_microarch}_{date}_BUILD_{toolchain}_{action}.log"
) )
# test no build log file for incorrect action installer_log_file_name = create_log_file_names(
installer_log_file, build_log_file = create_log_file_names(
mpsd_microarch=mpsd_microarch, mpsd_microarch=mpsd_microarch,
mpsd_release=mpsd_release, mpsd_release=mpsd_release,
date=date, date=date,
action="status", action=action,
toolchain=toolchain,
) )
assert installer_log_file == f"{mpsd_release}_{mpsd_microarch}_{date}_status.log" assert (
assert build_log_file is None installer_log_file_name
# test no build log file for incorrect toolchain == f"{mpsd_release}_{mpsd_microarch}_{date}_APEX_{action}.log"
installer_log_file, build_log_file = create_log_file_names( )
# test no build log file for incorrect action
build_log_file_name = create_log_file_names(
mpsd_microarch=mpsd_microarch, mpsd_microarch=mpsd_microarch,
mpsd_release=mpsd_release, mpsd_release=mpsd_release,
date=date, date=date,
action="reinstall", action="status",
toolchain=None, toolchain=toolchain,
) )
assert installer_log_file == f"{mpsd_release}_{mpsd_microarch}_{date}_reinstall.log" assert build_log_file_name is None
assert build_log_file is None
def test_interface(tmp_path): def test_interface(tmp_path):
......
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