Skip to content

Commit

Permalink
unzip stub, nf-test, snap
Browse files Browse the repository at this point in the history
  • Loading branch information
sateeshperi committed Dec 28, 2023
1 parent 6898156 commit dec35aa
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 36 deletions.
16 changes: 15 additions & 1 deletion modules/nf-core/unzip/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ 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 \\
Expand All @@ -34,4 +33,19 @@ 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
"""
}
58 changes: 58 additions & 0 deletions modules/nf-core/unzip/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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() }
)
}

}

}
2 changes: 2 additions & 0 deletions modules/nf-core/unzip/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
unzip:
- "modules/nf-core/unzip/**"
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2671,9 +2671,6 @@ 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/**
Expand Down
16 changes: 0 additions & 16 deletions tests/modules/nf-core/unzip/main.nf

This file was deleted.

5 changes: 0 additions & 5 deletions tests/modules/nf-core/unzip/nextflow.config

This file was deleted.

11 changes: 0 additions & 11 deletions tests/modules/nf-core/unzip/test.yml

This file was deleted.

0 comments on commit dec35aa

Please sign in to comment.