-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from nextflow-io/file-pattern-clashes
Add decent error messages for wrongly used file-path-pattern
- Loading branch information
Showing
5 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1097,7 +1097,7 @@ class ValidateParametersTest extends Dsl2Spec{ | |
given: | ||
def schema = Path.of('src/testResources/nextflow_schema.json').toAbsolutePath().toString() | ||
def SCRIPT = """ | ||
params.input = 'src/testResource/samplesheet.csv' | ||
params.input = 'src/testResources/samplesheet.csv' | ||
params.outdir = 'src/testResources/testDir' | ||
params.email = "[email protected]" | ||
include { validateParameters } from 'plugin/nf-schema' | ||
|
@@ -1122,7 +1122,7 @@ class ValidateParametersTest extends Dsl2Spec{ | |
given: | ||
def schema = Path.of('src/testResources/nextflow_schema.json').toAbsolutePath().toString() | ||
def SCRIPT = """ | ||
params.input = 'src/testResource/samplesheet.csv' | ||
params.input = 'src/testResources/samplesheet.csv' | ||
params.outdir = 'src/testResources/testDir' | ||
params.email = "thisisnotanemail" | ||
include { validateParameters } from 'plugin/nf-schema' | ||
|
@@ -1145,4 +1145,56 @@ class ValidateParametersTest extends Dsl2Spec{ | |
!stdout | ||
} | ||
|
||
def 'should give an error when a file-path-pattern is used with a file-path format' () { | ||
given: | ||
def schema = Path.of('src/testResources/nextflow_schema.json').toAbsolutePath().toString() | ||
def SCRIPT = """ | ||
params.input = 'src/testResources/*.csv' | ||
params.outdir = 'src/testResources/testDir' | ||
include { validateParameters } from 'plugin/nf-schema' | ||
validateParameters(parameters_schema: '$schema') | ||
""" | ||
|
||
when: | ||
def config = [:] | ||
def result = new MockScriptRunner(config).setScript(SCRIPT).execute() | ||
def stdout = capture | ||
.toString() | ||
.readLines() | ||
.findResults {it.contains('WARN nextflow.validation.SchemaValidator') || it.startsWith('* --') ? it : null } | ||
|
||
|
||
then: | ||
def error = thrown(SchemaValidationException) | ||
error.message.contains("* --input (src/testResources/*.csv): 'src/testResources/*.csv' is not a file, but a file path pattern") | ||
!stdout | ||
} | ||
|
||
def 'should give an error when a file-path-pattern is used with a directory-path format' () { | ||
given: | ||
def schema = Path.of('src/testResources/nextflow_schema.json').toAbsolutePath().toString() | ||
def SCRIPT = """ | ||
params.input = 'src/testResources/samplesheet.csv' | ||
params.outdir = 'src/testResources/testDi*' | ||
include { validateParameters } from 'plugin/nf-schema' | ||
validateParameters(parameters_schema: '$schema') | ||
""" | ||
|
||
when: | ||
def config = [:] | ||
def result = new MockScriptRunner(config).setScript(SCRIPT).execute() | ||
def stdout = capture | ||
.toString() | ||
.readLines() | ||
.findResults {it.contains('WARN nextflow.validation.SchemaValidator') || it.startsWith('* --') ? it : null } | ||
|
||
|
||
then: | ||
def error = thrown(SchemaValidationException) | ||
error.message.contains("* --outdir (src/testResources/testDi*): 'src/testResources/testDi*' is not a directory, but a file path pattern") | ||
!stdout | ||
} | ||
|
||
} |