Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap unzip to nf-test (continuation of 5357) #5897

Merged
merged 21 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/nf-core/malt/build/tests/main.nf.test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the input for unzip on line 19 is a 739.0 MiB zip...
I'm guessing that's why the tests are failing...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cf #4801

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ nextflow_process {
path("${process.out.index[0]}/ref.inf"),
path("${process.out.index[0]}/taxonomy.idx"),
path("${process.out.index[0]}/taxonomy.map"),
path("${process.out.index[0]}/taxonomy.tre")
path("${process.out.index[0]}/taxonomy.tre"),
process.out.versions
)
.match()
},
Expand Down
15 changes: 13 additions & 2 deletions modules/nf-core/malt/build/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-01-26T11:49:19.685017271"
},
"sarscov2 - fastq": {
Expand All @@ -36,8 +40,15 @@
"ref.inf:md5,b146842067cf278ef1d23e6c2e7c0c35",
"taxonomy.idx:md5,bb335e7c378a5bd85761b6eeed16d984",
"taxonomy.map:md5,5bb3f2192e925bca2e61e4b54f1671e0",
"taxonomy.tre:md5,f76fb2d5aa9b0d637234d48175841e0e"
"taxonomy.tre:md5,f76fb2d5aa9b0d637234d48175841e0e",
[
"versions.yml:md5,52c299d59c90219b9b442ee54f1acc97"
]
],
"timestamp": "2024-01-26T11:48:45.195850552"
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-06-30T19:04:45.72181253"
}
}
2 changes: 1 addition & 1 deletion modules/nf-core/malt/run/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ output:
type: file
description: MEGAN6 RMA6 file
pattern: "*.rma6"
- sam:
- alignments:
type: file
description: Alignment files in Tab, Text or MEGAN-compatible SAM format
pattern: "*.{tab,txt,sam}"
Expand Down
3 changes: 1 addition & 2 deletions modules/nf-core/malt/run/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// TODO nf-core: Once you have added the required tests, please run the following command to build this file:
// nf-core modules test malt/run
nextflow_process {

name "Test Process MALT_RUN"
Expand Down Expand Up @@ -56,6 +54,7 @@ nextflow_process {
{ assert process.success },
{ assert snapshot(
process.out.alignments,
process.out.versions,
file(process.out.rma6[0][1]).name
).match()
},
Expand Down
13 changes: 12 additions & 1 deletion modules/nf-core/malt/run/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-01-26T14:15:43.18685293"
},
"sarscov2 - fastq": {
Expand All @@ -77,8 +81,15 @@
"test_1.blastn.sam.gz:md5,8ad56803c1674e1a8cd42fe8801e71fd"
]
],
[
"versions.yml:md5,5b91a785e0342f9ef17a634c0452335a"
],
"test_1.rma6"
],
"timestamp": "2024-01-26T14:15:08.880645244"
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-06-30T07:04:07.674069223"
}
}
8 changes: 3 additions & 5 deletions modules/nf-core/maltextract/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ nextflow_process {
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match('version') },
// snapshots dont work, because the results channel contains a log file that changes with each run
{ assert snapshot(
path("${process.out.results.get(0).get(1)}/ScanSummary.txt"),
).match('results')
}
process.out.versions,
path("${process.out.results.get(0).get(1)}/ScanSummary.txt")
).match() },
)
}
}
Expand Down
17 changes: 4 additions & 13 deletions modules/nf-core/maltextract/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
{
"version": {
"test_maltextract": {
"content": [
[
"versions.yml:md5,4d87de5def1287321effde6545901cf6"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.0"
},
"timestamp": "2024-03-19T13:58:17.979106"
},
"results": {
"content": [
],
"ScanSummary.txt:md5,209fb35426f6a459db0f4af0dc544b10"
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.0"
"nextflow": "24.04.2"
},
"timestamp": "2024-03-19T14:03:56.643826"
"timestamp": "2024-07-01T08:19:20.696046683"
}
}
14 changes: 13 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,17 @@ 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}"

cat <<-END_VERSIONS > versions.yml
"${task.process}":
7za: \$(echo \$(7za --help) | sed 's/.*p7zip Version //; s/(.*//')
END_VERSIONS
"""
}
54 changes: 54 additions & 0 deletions modules/nf-core/unzip/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
nextflow_process {

name "Test Process UNZIP"
script "../main.nf"
process "UNZIP"

tag "modules"
tag "modules_nfcore"
tag "unzip"

test("generic [tar] [tar_gz]") {

when {
process {
"""
input[0] = [
[ id: 'hello' ],
file(params.modules_testdata_base_path + 'generic/tar/hello.tar.gz', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("generic [tar] [tar_gz] stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id: 'hello' ],
file(params.modules_testdata_base_path + 'generic/tar/hello.tar.gz', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
76 changes: 76 additions & 0 deletions modules/nf-core/unzip/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"generic [tar] [tar_gz] stub": {
"content": [
{
"0": [
[
{
"id": "hello"
},
[

]
]
],
"1": [
"versions.yml:md5,52c55ce814e8bc9edc5a6c625ed794b8"
],
"unzipped_archive": [
[
{
"id": "hello"
},
[

]
]
],
"versions": [
"versions.yml:md5,52c55ce814e8bc9edc5a6c625ed794b8"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-06-30T19:16:37.11550986"
},
"generic [tar] [tar_gz]": {
"content": [
{
"0": [
[
{
"id": "hello"
},
[
"hello.tar:md5,80c66db79a773bc87b3346035ff9593e"
]
]
],
"1": [
"versions.yml:md5,52c55ce814e8bc9edc5a6c625ed794b8"
],
"unzipped_archive": [
[
{
"id": "hello"
},
[
"hello.tar:md5,80c66db79a773bc87b3346035ff9593e"
]
]
],
"versions": [
"versions.yml:md5,52c55ce814e8bc9edc5a6c625ed794b8"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-06-30T19:16:25.120242571"
}
}
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/**"
12 changes: 12 additions & 0 deletions modules/nf-core/unzipfiles/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,16 @@ process UNZIPFILES {
7za: \$(echo \$(7za --help) | sed 's/.*p7zip Version //; s/(.*//')
END_VERSIONS
"""

stub:
prefix = task.ext.prefix ?: ( meta.id ? "${meta.id}" : archive.baseName)
"""
mkdir "${prefix}"
touch "${prefix}/hello.txt"

cat <<-END_VERSIONS > versions.yml
"${task.process}":
7za: \$(echo \$(7za --help) | sed 's/.*p7zip Version //; s/(.*//')
END_VERSIONS
"""
}
55 changes: 55 additions & 0 deletions modules/nf-core/unzipfiles/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
nextflow_process {

name "Test Process UNZIPFILES"
script "../main.nf"
process "UNZIPFILES"

tag "modules"
tag "modules_nfcore"
tag "unzipfiles"

test("generic [tar] [tar_gz]") {

when {
process {
"""
input[0] = [
[ id: 'hello' ],
file(params.modules_testdata_base_path + 'generic/tar/hello.tar.gz', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("generic [tar] [tar_gz] stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id: 'hello' ],
file(params.modules_testdata_base_path + 'generic/tar/hello.tar.gz', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

}
Loading
Loading