From 84f2302920078b0cf7716b2a2e5fcc0be5c4531d Mon Sep 17 00:00:00 2001 From: Jose Espinosa-Carrasco Date: Wed, 6 Oct 2021 08:16:36 +0200 Subject: [PATCH] Correct parsing versions with trailing zeros (#795) * Correct parsing versions with trailing zeros * Fix test * Update modules/custom/dumpsoftwareversions/main.nf Co-authored-by: Harshil Patel * Fix tests and go back to output versions.yml * Update tests/test_versions_yml.py to use BaseLoader Co-authored-by: Harshil Patel Co-authored-by: Gregor Sturm --- modules/custom/dumpsoftwareversions/main.nf | 2 +- tests/modules/custom/dumpsoftwareversions/main.nf | 4 ++-- tests/test_versions_yml.py | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/custom/dumpsoftwareversions/main.nf b/modules/custom/dumpsoftwareversions/main.nf index cf10a8e0..faf2073f 100644 --- a/modules/custom/dumpsoftwareversions/main.nf +++ b/modules/custom/dumpsoftwareversions/main.nf @@ -79,7 +79,7 @@ process CUSTOM_DUMPSOFTWAREVERSIONS { } with open("$versions") as f: - workflow_versions = yaml.safe_load(f) | module_versions + workflow_versions = yaml.load(f, Loader=yaml.BaseLoader) | module_versions workflow_versions["Workflow"] = { "Nextflow": "$workflow.nextflow.version", diff --git a/tests/modules/custom/dumpsoftwareversions/main.nf b/tests/modules/custom/dumpsoftwareversions/main.nf index 94dbc5fb..020b19bd 100644 --- a/tests/modules/custom/dumpsoftwareversions/main.nf +++ b/tests/modules/custom/dumpsoftwareversions/main.nf @@ -17,8 +17,8 @@ workflow test_custom_dumpsoftwareversions { MULTIQC ( FASTQC.out.zip.collect { it[1] } ) ch_software_versions = Channel.empty() - ch_software_versions = ch_software_versions.mix(FASTQC.out.version) - ch_software_versions = ch_software_versions.mix(MULTIQC.out.version) + ch_software_versions = ch_software_versions.mix(FASTQC.out.versions) + ch_software_versions = ch_software_versions.mix(MULTIQC.out.versions) CUSTOM_DUMPSOFTWAREVERSIONS ( ch_software_versions.collectFile() ) } diff --git a/tests/test_versions_yml.py b/tests/test_versions_yml.py index b6392b87..759fc4d5 100644 --- a/tests/test_versions_yml.py +++ b/tests/test_versions_yml.py @@ -13,7 +13,8 @@ def _get_workflow_names(): here = Path(__file__).parent.resolve() pytest_workflow_files = here.glob("**/test.yml") for f in pytest_workflow_files: - test_config = yaml.safe_load(f.read_text()) + # test_config = yaml.safe_load(f.read_text()) + test_config = yaml.load(f.read_text(), Loader=yaml.BaseLoader) for workflow in test_config: yield workflow["name"]