Skip to content

Commit

Permalink
CHORES: Move pytest to nf-test for sratools/prefetch (nf-core#3938)
Browse files Browse the repository at this point in the history
* move nf_test modules.yml file to .github/

* update and sort file

* use /tmp

* add tests for prefetch

* remove pytest for sratools/prefetch

* Update modules.yml
  • Loading branch information
maxulysse committed Oct 10, 2023
1 parent 513cfc9 commit efdda7b
Show file tree
Hide file tree
Showing 10 changed files with 181 additions and 69 deletions.
3 changes: 3 additions & 0 deletions tests/config/nftest_modules.yml → .github/modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ fastqc:

snakemake:
- modules/nf-core/snakemake/**

sratools/prefetch:
- modules/nf-core/sratools/prefetch/**
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ jobs:
- uses: dorny/paths-filter@v2
id: filter
with:
filters: "tests/config/nftest_modules.yml"
filters: ".github/modules.yml"
token: "${{ secrets.GITHUB_TOKEN }}"

nf-test:
Expand Down
22 changes: 12 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
*.code-workspace
*.pyc
*.pyo
.*.sw?
.DS_Store
.nextflow*
work/
results/
test_output/
.nf-test.log
.nf-test/
output/
.DS_Store
*.code-workspace
tests/data/
.screenrc
.*.sw?
__pycache__
*.pyo
*.pyc
output/
results/
test.xml
test_output/
tests/data/
work/
54 changes: 54 additions & 0 deletions modules/nf-core/sratools/prefetch/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
nextflow_process {

name "Test Process SRATOOLS_PREFETCH"
script "modules/nf-core/sratools/prefetch/main.nf"
process "SRATOOLS_PREFETCH"
tag "sratools/prefetch"
tag "modules_nfcore"

test("sratools/prefetch") {

when {
params {
outdir = "output"
}
process {
"""
input[0] = [ [ id:'test', single_end:false ], 'DRR000774' ]
input[1] = file(params.test_data['generic']['config']['ncbi_user_settings'])
input[2] = []
"""
}
}

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

test("sratools/prefetch with sralite") {

when {
params {
outdir = "output"
}
process {
"""
input[0] = [ [ id:'test', single_end:false ], 'SRR1170046' ]
input[1] = file(params.test_data['generic']['config']['ncbi_user_settings'])
input[2] = []
"""
}
}

then {
assertAll (
{ assert process.success },
{ assert snapshot(process).match() }
)
}
}
}
110 changes: 110 additions & 0 deletions modules/nf-core/sratools/prefetch/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"sratools/prefetch with sralite": {
"content": [
{
"stderr": [

],
"errorReport": null,
"exitStatus": 0,
"out": {
"0": [
[
{
"id": "test",
"single_end": false
},
[
"SRR1170046.sralite:md5,7acfce556ca0951aff49d780899c105b"
]
]
],
"1": [
"versions.yml:md5,c967dea4135cb75490e1e801c4639efc"
],
"sra": [
[
{
"id": "test",
"single_end": false
},
[
"SRR1170046.sralite:md5,7acfce556ca0951aff49d780899c105b"
]
]
],
"versions": [
"versions.yml:md5,c967dea4135cb75490e1e801c4639efc"
]
},
"failed": false,
"stdout": [

],
"errorMessage": null,
"trace": {
"tasksFailed": 0,
"tasksCount": 1,
"tasksSucceeded": 1
},
"name": "SRATOOLS_PREFETCH",
"success": true
}
],
"timestamp": "2023-10-10T10:00:01.515299"
},
"sratools/prefetch": {
"content": [
{
"stderr": [

],
"errorReport": null,
"exitStatus": 0,
"out": {
"0": [
[
{
"id": "test",
"single_end": false
},
[
"DRR000774.sra:md5,7647dba20c89c0e3d7ad13842f060eb0"
]
]
],
"1": [
"versions.yml:md5,c967dea4135cb75490e1e801c4639efc"
],
"sra": [
[
{
"id": "test",
"single_end": false
},
[
"DRR000774.sra:md5,7647dba20c89c0e3d7ad13842f060eb0"
]
]
],
"versions": [
"versions.yml:md5,c967dea4135cb75490e1e801c4639efc"
]
},
"failed": false,
"stdout": [

],
"errorMessage": null,
"trace": {
"tasksFailed": 0,
"tasksCount": 1,
"tasksSucceeded": 1
},
"name": "SRATOOLS_PREFETCH",
"success": true
}
],
"timestamp": "2023-10-10T09:58:01.781848"
}
}
2 changes: 1 addition & 1 deletion nf-test.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ config {
testsDir "."

// nf-test directory including temporary files for each test
workDir ".nf-test"
workDir "/tmp"

// location of an optional nextflow.config file specific for executing tests
configFile "tests/config/nf-test.config"
Expand Down
4 changes: 0 additions & 4 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3712,10 +3712,6 @@ sratools/fasterqdump:
- modules/nf-core/sratools/fasterqdump/**
- tests/modules/nf-core/sratools/fasterqdump/**

sratools/prefetch:
- modules/nf-core/sratools/prefetch/**
- tests/modules/nf-core/sratools/prefetch/**

srst2/srst2:
- modules/nf-core/srst2/srst2/**
- tests/modules/nf-core/srst2/srst2/**
Expand Down
25 changes: 0 additions & 25 deletions tests/modules/nf-core/sratools/prefetch/main.nf

This file was deleted.

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

This file was deleted.

23 changes: 0 additions & 23 deletions tests/modules/nf-core/sratools/prefetch/test.yml

This file was deleted.

0 comments on commit efdda7b

Please sign in to comment.