Skip to content

Commit

Permalink
6201 feature add stub in picardcreatesequencedictionary (nf-core#6205)
Browse files Browse the repository at this point in the history
* migrate-pytest

* updated snapshots

* Update modules/nf-core/picard/createsequencedictionary/tests/main.nf.test

Co-authored-by: Maxime U Garcia <[email protected]>

* recreate snaps

* Update modules/nf-core/picard/createsequencedictionary/main.nf

---------

Co-authored-by: Maxime U Garcia <[email protected]>
  • Loading branch information
kubranarci and maxulysse authored Aug 19, 2024
1 parent 29d01cb commit 759232f
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 32 deletions.
12 changes: 12 additions & 0 deletions modules/nf-core/picard/createsequencedictionary/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,16 @@ process PICARD_CREATESEQUENCEDICTIONARY {
picard: \$(picard CreateSequenceDictionary --version 2>&1 | grep -o 'Version:.*' | cut -f2- -d:)
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.dict
cat <<-END_VERSIONS > versions.yml
"${task.process}":
picard: \$(echo \$(picard CreateSequenceDictionary --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d:)
END_VERSIONS
"""

}
61 changes: 61 additions & 0 deletions modules/nf-core/picard/createsequencedictionary/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "picard"
tag "picard/createsequencedictionary"

test("sarscov2 - fasta") {

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
file(process.out.reference_dict[0][1]).name,
process.out.versions
).match()
}

)
}

}

test("sarscov2 - fasta - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]
"""
}
}

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

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"sarscov2 - fasta - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.dict:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,fdb110d8c303ffa0615bb200f9a2c999"
],
"reference_dict": [
[
{
"id": "test"
},
"test.dict:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,fdb110d8c303ffa0615bb200f9a2c999"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-08-19T07:02:59.686224426"
},
"sarscov2 - fasta": {
"content": [
"test.dict",
[
"versions.yml:md5,fdb110d8c303ffa0615bb200f9a2c999"
]
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-08-16T14:31:34.330709472"
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1121,9 +1121,6 @@ picard/collectrnaseqmetrics:
picard/collectwgsmetrics:
- modules/nf-core/picard/collectwgsmetrics/**
- tests/modules/nf-core/picard/collectwgsmetrics/**
picard/createsequencedictionary:
- modules/nf-core/picard/createsequencedictionary/**
- tests/modules/nf-core/picard/createsequencedictionary/**
picard/fastqtosam:
- modules/nf-core/picard/fastqtosam/**
- tests/modules/nf-core/picard/fastqtosam/**
Expand Down
15 changes: 0 additions & 15 deletions tests/modules/nf-core/picard/createsequencedictionary/main.nf

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 759232f

Please sign in to comment.