diff --git a/modules/nf-core/unzip/main.nf b/modules/nf-core/unzip/main.nf index ace123ed575..08cfc3c4060 100644 --- a/modules/nf-core/unzip/main.nf +++ b/modules/nf-core/unzip/main.nf @@ -20,6 +20,7 @@ process UNZIP { script: def args = task.ext.args ?: '' if ( archive instanceof List && archive.name.size > 1 ) { error "[UNZIP] error: 7za only accepts a single archive as input. Please check module input." } + prefix = task.ext.prefix ?: ( meta.id ? "${meta.id}" : archive.baseName) """ 7za \\ @@ -33,19 +34,4 @@ process UNZIP { 7za: \$(echo \$(7za --help) | sed 's/.*p7zip Version //; s/(.*//') END_VERSIONS """ - - stub: - def args = task.ext.args ?: '' - if ( archive instanceof List && archive.name.size > 1 ) { error "[UNZIP] error: 7za only accepts a single archive as input. Please check module input." } - prefix = task.ext.prefix ?: ( meta.id ? "${meta.id}" : archive.baseName) - """ - mkdir "${prefix}" - touch "${prefix}"/ncbi.map - touch "${prefix}"/ncbi.tre - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - 7za: \$(echo \$(7za --help) | sed 's/.*p7zip Version //; s/(.*//') - END_VERSIONS - """ } diff --git a/modules/nf-core/unzip/tests/main.nf.test b/modules/nf-core/unzip/tests/main.nf.test deleted file mode 100644 index aebf0c7bad4..00000000000 --- a/modules/nf-core/unzip/tests/main.nf.test +++ /dev/null @@ -1,58 +0,0 @@ -nextflow_process { - - name "Test Process UNZIP" - script "../main.nf" - process "UNZIP" - - tag "modules" - tag "modules_nfcore" - tag "unzip" - - test("sarscov2 genome ncbi_taxmap [zip]") { - - when { - process { - """ - input[0] = [ - [ id: 'test' ], - file(params.test_data['sarscov2']['genome']['ncbi_taxmap_zip'], checkIfExists: true) - ] - """ - } - } - - then { - assertAll( - { assert process.success }, - { assert snapshot( path(process.out.unzipped_archive[0][1]).list() ).match() } // FIX-ME - ) - } - - } - - test("sarscov2 genome ncbi_taxmap [zip] - stub") { - - options "-stub" - - when { - process { - """ - input[0] = [ - [ id: 'test' ], - file(params.test_data['sarscov2']['genome']['ncbi_taxmap_zip'], checkIfExists: true) - ] - """ - } - } - - then { - assertAll( - { assert process.success }, - { assert snapshot(process.out.unzipped_archive.collect { file(it[1]).getName() } + - process.out.versions ).match() } - ) - } - - } - -} diff --git a/modules/nf-core/unzip/tests/tags.yml b/modules/nf-core/unzip/tests/tags.yml deleted file mode 100644 index 7f5647e1206..00000000000 --- a/modules/nf-core/unzip/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -unzip: - - "modules/nf-core/unzip/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 9f2fd13ec91..6aae9729bf9 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -2671,6 +2671,9 @@ universc: untarfiles: - modules/nf-core/untarfiles/** - tests/modules/nf-core/untarfiles/** +unzip: + - modules/nf-core/unzip/** + - tests/modules/nf-core/unzip/** unzipfiles: - modules/nf-core/unzipfiles/** - tests/modules/nf-core/unzipfiles/** diff --git a/tests/modules/nf-core/unzip/main.nf b/tests/modules/nf-core/unzip/main.nf new file mode 100644 index 00000000000..553ea964148 --- /dev/null +++ b/tests/modules/nf-core/unzip/main.nf @@ -0,0 +1,16 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { UNZIP } from '../../../../modules/nf-core/unzip/main.nf' + +workflow test_unzip { + + archive = [ + [], + file(params.test_data['sarscov2']['genome']['ncbi_taxmap_zip'], checkIfExists: true) + ] + + UNZIP ( archive ) +} + diff --git a/tests/modules/nf-core/unzip/nextflow.config b/tests/modules/nf-core/unzip/nextflow.config new file mode 100644 index 00000000000..8730f1c4b93 --- /dev/null +++ b/tests/modules/nf-core/unzip/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} diff --git a/tests/modules/nf-core/unzip/test.yml b/tests/modules/nf-core/unzip/test.yml new file mode 100644 index 00000000000..004710dd5a4 --- /dev/null +++ b/tests/modules/nf-core/unzip/test.yml @@ -0,0 +1,11 @@ +- name: unzip test_unzip + command: nextflow run ./tests/modules/nf-core/unzip -entry test_unzip -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/unzip/nextflow.config + tags: + - unzip + files: + - path: output/unzip/ncbi_taxmap/ + - path: output/unzip/ncbi_taxmap/ncbi.map + md5sum: de30dbba85f9070612b632e2a5a95952 + - path: output/unzip/ncbi_taxmap/ncbi.tre + md5sum: 4029dd2091c685b9a86ddd9d0d870db0 + - path: output/unzip/versions.yml