diff --git a/modules/nf-core/malt/build/tests/main.nf.test b/modules/nf-core/malt/build/tests/main.nf.test index 820b5948468..229460271c6 100644 --- a/modules/nf-core/malt/build/tests/main.nf.test +++ b/modules/nf-core/malt/build/tests/main.nf.test @@ -27,7 +27,7 @@ nextflow_process { when { process { """ - input[0] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + input[0] = file(params.modules_testdata_base_path + "genomics/sarscov2/genome/genome.fasta", checkIfExists: true) input[1] = [] input[2] = UNZIP.out.unzipped_archive.map { it[1] } """ @@ -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() }, @@ -64,7 +65,7 @@ nextflow_process { when { process { """ - input[0] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + input[0] = file(params.modules_testdata_base_path + "genomics/sarscov2/genome/genome.fasta", checkIfExists: true) input[1] = [] input[2] = UNZIP.out.unzipped_archive.map { it[1] } """ diff --git a/modules/nf-core/malt/build/tests/main.nf.test.snap b/modules/nf-core/malt/build/tests/main.nf.test.snap index f0b2a55a99e..421a154d2bc 100644 --- a/modules/nf-core/malt/build/tests/main.nf.test.snap +++ b/modules/nf-core/malt/build/tests/main.nf.test.snap @@ -26,6 +26,10 @@ ] } ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, "timestamp": "2024-01-26T11:49:19.685017271" }, "sarscov2 - fastq": { @@ -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" } } \ No newline at end of file diff --git a/modules/nf-core/malt/run/meta.yml b/modules/nf-core/malt/run/meta.yml index b6e4488b4ca..5bb7d9b3f32 100644 --- a/modules/nf-core/malt/run/meta.yml +++ b/modules/nf-core/malt/run/meta.yml @@ -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}" diff --git a/modules/nf-core/malt/run/tests/main.nf.test b/modules/nf-core/malt/run/tests/main.nf.test index 8724fefd5bf..304c01d4a21 100644 --- a/modules/nf-core/malt/run/tests/main.nf.test +++ b/modules/nf-core/malt/run/tests/main.nf.test @@ -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" @@ -27,7 +25,7 @@ nextflow_process { script "../../../malt/build/main.nf" process { """ - input[0] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + input[0] = file(params.modules_testdata_base_path + "genomics/sarscov2/genome/genome.fasta", checkIfExists: true) input[1] = [] input[2] = UNZIP.out.unzipped_archive.map { it[1] } """ @@ -43,7 +41,7 @@ nextflow_process { input[0] = [ [ id:'test_1', single_end:false ], [ - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/fastq/test_1.fastq.gz", checkIfExists: true) ] ] input[1] = MALT_BUILD.out.index @@ -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() }, @@ -75,7 +74,7 @@ nextflow_process { input[0] = [ [ id:'test_1', single_end:false ], [ - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/fastq/test_1.fastq.gz", checkIfExists: true) ] ] input[1] = MALT_BUILD.out.index diff --git a/modules/nf-core/malt/run/tests/main.nf.test.snap b/modules/nf-core/malt/run/tests/main.nf.test.snap index bf060ba9a5f..5a6c7a21a57 100644 --- a/modules/nf-core/malt/run/tests/main.nf.test.snap +++ b/modules/nf-core/malt/run/tests/main.nf.test.snap @@ -64,6 +64,10 @@ ] } ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, "timestamp": "2024-01-26T14:15:43.18685293" }, "sarscov2 - fastq": { @@ -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" } } \ No newline at end of file diff --git a/modules/nf-core/maltextract/tests/main.nf.test b/modules/nf-core/maltextract/tests/main.nf.test index 6d529ebb4f7..0cc9701d126 100644 --- a/modules/nf-core/maltextract/tests/main.nf.test +++ b/modules/nf-core/maltextract/tests/main.nf.test @@ -15,7 +15,7 @@ nextflow_process { script "../../unzip/main.nf" process { """ - input[0] = [[], file('https://github.com/nf-core/test-datasets/raw/modules/data/genomics/sarscov2/genome/db/maltextract/ncbi_taxmap.zip')] + input[0] = [[], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/maltextract/ncbi_taxmap.zip')] """ } } @@ -25,8 +25,9 @@ nextflow_process { process { """ input[0] = [ [], // meta map - file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/malt/test.rma6') ] - input[1] = file('https://github.com/nf-core/test-datasets/raw/modules/data/genomics/sarscov2/genome/db/maltextract/taxon_list.txt') + file(params.modules_testdata_base_path + 'delete_me/malt/test.rma6') + ] + input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/maltextract/taxon_list.txt') input[2] = UNZIP.out.unzipped_archive.map { it[1] } """ } @@ -35,12 +36,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() }, ) } } diff --git a/modules/nf-core/maltextract/tests/main.nf.test.snap b/modules/nf-core/maltextract/tests/main.nf.test.snap index d4e5c37b6b1..af63f7878fc 100644 --- a/modules/nf-core/maltextract/tests/main.nf.test.snap +++ b/modules/nf-core/maltextract/tests/main.nf.test.snap @@ -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" } } \ No newline at end of file diff --git a/modules/nf-core/unzip/main.nf b/modules/nf-core/unzip/main.nf index 08cfc3c4060..a0c02109cde 100644 --- a/modules/nf-core/unzip/main.nf +++ b/modules/nf-core/unzip/main.nf @@ -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 \\ @@ -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 + """ } diff --git a/modules/nf-core/unzip/tests/main.nf.test b/modules/nf-core/unzip/tests/main.nf.test new file mode 100644 index 00000000000..238b68d8ba5 --- /dev/null +++ b/modules/nf-core/unzip/tests/main.nf.test @@ -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() } + ) + } + } +} diff --git a/modules/nf-core/unzip/tests/main.nf.test.snap b/modules/nf-core/unzip/tests/main.nf.test.snap new file mode 100644 index 00000000000..cdd2ab1641c --- /dev/null +++ b/modules/nf-core/unzip/tests/main.nf.test.snap @@ -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" + } +} \ No newline at end of file diff --git a/modules/nf-core/unzip/tests/tags.yml b/modules/nf-core/unzip/tests/tags.yml new file mode 100644 index 00000000000..7f5647e1206 --- /dev/null +++ b/modules/nf-core/unzip/tests/tags.yml @@ -0,0 +1,2 @@ +unzip: + - "modules/nf-core/unzip/**" diff --git a/modules/nf-core/unzipfiles/main.nf b/modules/nf-core/unzipfiles/main.nf index 5b5c15bebc5..c9ab1a2bc29 100644 --- a/modules/nf-core/unzipfiles/main.nf +++ b/modules/nf-core/unzipfiles/main.nf @@ -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 + """ } diff --git a/modules/nf-core/unzipfiles/tests/main.nf.test b/modules/nf-core/unzipfiles/tests/main.nf.test new file mode 100644 index 00000000000..d0164fae336 --- /dev/null +++ b/modules/nf-core/unzipfiles/tests/main.nf.test @@ -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() } + ) + } + } + +} diff --git a/modules/nf-core/unzipfiles/tests/main.nf.test.snap b/modules/nf-core/unzipfiles/tests/main.nf.test.snap new file mode 100644 index 00000000000..da2ce5ac312 --- /dev/null +++ b/modules/nf-core/unzipfiles/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "generic [tar] [tar_gz] stub": { + "content": [ + { + "0": [ + [ + { + "id": "hello" + }, + "hello.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,5568819fdcb4b0b9fffccf6e4c169bf1" + ], + "files": [ + [ + { + "id": "hello" + }, + "hello.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,5568819fdcb4b0b9fffccf6e4c169bf1" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-07-01T06:15:21.647332776" + }, + "generic [tar] [tar_gz]": { + "content": [ + { + "0": [ + [ + { + "id": "hello" + }, + "hello.tar:md5,80c66db79a773bc87b3346035ff9593e" + ] + ], + "1": [ + "versions.yml:md5,5568819fdcb4b0b9fffccf6e4c169bf1" + ], + "files": [ + [ + { + "id": "hello" + }, + "hello.tar:md5,80c66db79a773bc87b3346035ff9593e" + ] + ], + "versions": [ + "versions.yml:md5,5568819fdcb4b0b9fffccf6e4c169bf1" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-07-01T06:15:08.983303244" + } +} \ No newline at end of file diff --git a/modules/nf-core/unzipfiles/tests/tags.yml b/modules/nf-core/unzipfiles/tests/tags.yml new file mode 100644 index 00000000000..5d1fa24d4a0 --- /dev/null +++ b/modules/nf-core/unzipfiles/tests/tags.yml @@ -0,0 +1,2 @@ +unzipfiles: + - "modules/nf-core/unzipfiles/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 1070af3b8df..49aed145a6b 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1740,12 +1740,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/** upd: - modules/nf-core/upd/** - tests/modules/nf-core/upd/** diff --git a/tests/modules/nf-core/unzip/main.nf b/tests/modules/nf-core/unzip/main.nf deleted file mode 100644 index 553ea964148..00000000000 --- a/tests/modules/nf-core/unzip/main.nf +++ /dev/null @@ -1,16 +0,0 @@ -#!/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 deleted file mode 100644 index 8730f1c4b93..00000000000 --- a/tests/modules/nf-core/unzip/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 004710dd5a4..00000000000 --- a/tests/modules/nf-core/unzip/test.yml +++ /dev/null @@ -1,11 +0,0 @@ -- 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 diff --git a/tests/modules/nf-core/unzipfiles/main.nf b/tests/modules/nf-core/unzipfiles/main.nf deleted file mode 100644 index fce389ad42b..00000000000 --- a/tests/modules/nf-core/unzipfiles/main.nf +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { UNZIPFILES } from '../../../../modules/nf-core/unzipfiles/main.nf' - -workflow test_unzipfiles { - - archive = [ - [id: 'test'], - file(params.test_data['sarscov2']['genome']['ncbi_taxmap_zip'], checkIfExists: true) - ] - - UNZIPFILES ( archive ) -} - diff --git a/tests/modules/nf-core/unzipfiles/nextflow.config b/tests/modules/nf-core/unzipfiles/nextflow.config deleted file mode 100644 index 8730f1c4b93..00000000000 --- a/tests/modules/nf-core/unzipfiles/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} diff --git a/tests/modules/nf-core/unzipfiles/test.yml b/tests/modules/nf-core/unzipfiles/test.yml deleted file mode 100644 index f2ed31d8d18..00000000000 --- a/tests/modules/nf-core/unzipfiles/test.yml +++ /dev/null @@ -1,11 +0,0 @@ -- name: unzipfiles test_unzipfiles - command: nextflow run ./tests/modules/nf-core/unzipfiles -entry test_unzipfiles -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/unzipfiles/nextflow.config - tags: - - unzipfiles - files: - - path: output/unzipfiles/test/ - - path: output/unzipfiles/test/ncbi.map - md5sum: de30dbba85f9070612b632e2a5a95952 - - path: output/unzipfiles/test/ncbi.tre - md5sum: 4029dd2091c685b9a86ddd9d0d870db0 - - path: output/unzipfiles/versions.yml