Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ testing/
testing*
*.pyc
null/
.nf-test*
50 changes: 50 additions & 0 deletions .nf-test.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Mar-25 18:17:56.633 [main] INFO com.askimed.nf.test.App - nf-test 0.9.2
Mar-25 18:17:56.639 [main] INFO com.askimed.nf.test.App - Arguments: [test, modules/local/points2regions/tests/main.nf.test, --profile, docker]
Mar-25 18:17:57.026 [main] INFO com.askimed.nf.test.App - Nextflow Version: 24.10.5
Mar-25 18:17:57.028 [main] WARN com.askimed.nf.test.commands.RunTestsCommand - No nf-test config file found.
Mar-25 18:17:57.058 [main] INFO com.askimed.nf.test.lang.dependencies.DependencyResolver - Loaded 43 files from directory /Users/obrovkina/Documents/Projects/spatialxe in 0.029 sec
Mar-25 18:17:57.059 [main] INFO com.askimed.nf.test.lang.dependencies.DependencyResolver - Found 1 files containing tests.
Mar-25 18:17:57.059 [main] DEBUG com.askimed.nf.test.lang.dependencies.DependencyResolver - Found files: [/Users/obrovkina/Documents/Projects/spatialxe/modules/local/points2regions/tests/main.nf.test]
Mar-25 18:17:57.280 [main] INFO com.askimed.nf.test.commands.RunTestsCommand - Found 1 tests to execute.
Mar-25 18:17:57.280 [main] INFO com.askimed.nf.test.core.TestExecutionEngine - Started test plan
Mar-25 18:17:57.280 [main] INFO com.askimed.nf.test.core.TestExecutionEngine - Running testsuite 'Test Process POINTS2REGIONS_CLUSTER' from file '/Users/obrovkina/Documents/Projects/spatialxe/modules/local/points2regions/tests/main.nf.test'.
Mar-25 18:17:57.280 [main] INFO com.askimed.nf.test.core.TestExecutionEngine - Run test '9b856baf: cluster - with Xenium transcripts.csv'. type: com.askimed.nf.test.lang.process.ProcessTest
Mar-25 18:18:11.859 [main] INFO com.askimed.nf.test.core.TestExecutionEngine - Test '9b856baf: cluster - with Xenium transcripts.csv' finished. status: FAILED
org.codehaus.groovy.runtime.powerassert.PowerAssertionError: 2 of 2 assertions failed
at com.askimed.nf.test.lang.extensions.GlobalMethods.assertAll(GlobalMethods.java:48)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.invoke(StaticMetaMethodSite.java:44)
at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.callStatic(StaticMetaMethodSite.java:100)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:55)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:217)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:240)
at main_nf$_run_closure1$_closure3$_closure7.doCall(main.nf.test:33)
at main_nf$_run_closure1$_closure3$_closure7.doCall(main.nf.test)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:274)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1030)
at groovy.lang.Closure.call(Closure.java:427)
at groovy.lang.Closure.call(Closure.java:406)
at com.askimed.nf.test.lang.TestCode.execute(TestCode.java:16)
at com.askimed.nf.test.lang.process.ProcessTest.execute(ProcessTest.java:171)
at com.askimed.nf.test.core.TestExecutionEngine.execute(TestExecutionEngine.java:165)
at com.askimed.nf.test.commands.RunTestsCommand.execute(RunTestsCommand.java:298)
at com.askimed.nf.test.commands.AbstractCommand.call(AbstractCommand.java:43)
at com.askimed.nf.test.commands.AbstractCommand.call(AbstractCommand.java:18)
at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine.execute(CommandLine.java:2078)
at com.askimed.nf.test.App.run(App.java:39)
at com.askimed.nf.test.App.main(App.java:46)
Mar-25 18:18:11.860 [main] INFO com.askimed.nf.test.core.TestExecutionEngine - Testsuite 'Test Process POINTS2REGIONS_CLUSTER' finished. snapshot file: false, skipped tests: false, failed tests: true
Mar-25 18:18:11.860 [main] INFO com.askimed.nf.test.core.TestExecutionEngine - Executed 1 tests. 1 tests failed. Done!
97 changes: 97 additions & 0 deletions .nf-test/tests/9b856baf5b74f66fed52051240a30667/meta/mock.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import groovy.json.JsonGenerator
import groovy.json.JsonGenerator.Converter

nextflow.enable.dsl=2

// comes from nf-test to store json files
params.nf_test_output = ""

// include dependencies

include { UNZIP } from '/Users/obrovkina/Documents/Projects/spatialxe/modules/nf-core/unzip/main.nf'


// include test process
include { POINTS2REGIONS_CLUSTER } from '/Users/obrovkina/Documents/Projects/spatialxe/modules/local/points2regions/tests/../main.nf'

// define custom rules for JSON that will be generated.
def jsonOutput =
new JsonGenerator.Options()
.addConverter(Path) { value -> value.toAbsolutePath().toString() } // Custom converter for Path. Only filename
.build()

def jsonWorkflowOutput = new JsonGenerator.Options().excludeNulls().build()


workflow {

// run dependencies

{
def input = []

input[0] = [[], file('https://raw.githubusercontent.com/nf-core/test-datasets/spatialxe/Xenium_Prime_Mouse_Ileum_tiny_outs.zip', checkIfExists: true)]

UNZIP(*input)
}


// process mapping
def input = []

input[0] = Channel.of([
[id: "test"],
]).combine(UNZIP.out.unzipped_archive.map { it[1] } + "/transcripts.csv")
input[1] = 20
input[2] = 5

//----

//run process
POINTS2REGIONS_CLUSTER(*input)

if (POINTS2REGIONS_CLUSTER.output){

// consumes all named output channels and stores items in a json file
for (def name in POINTS2REGIONS_CLUSTER.out.getNames()) {
serializeChannel(name, POINTS2REGIONS_CLUSTER.out.getProperty(name), jsonOutput)
}

// consumes all unnamed output channels and stores items in a json file
def array = POINTS2REGIONS_CLUSTER.out as Object[]
for (def i = 0; i < array.length ; i++) {
serializeChannel(i, array[i], jsonOutput)
}

}

}

def serializeChannel(name, channel, jsonOutput) {
def _name = name
def list = [ ]
channel.subscribe(
onNext: {
list.add(it)
},
onComplete: {
def map = new HashMap()
map[_name] = list
def filename = "${params.nf_test_output}/output_${_name}.json"
new File(filename).text = jsonOutput.toJson(map)
}
)
}


workflow.onComplete {

def result = [
success: workflow.success,
exitStatus: workflow.exitStatus,
errorMessage: workflow.errorMessage,
errorReport: workflow.errorReport
]
new File("${params.nf_test_output}/workflow.json").text = jsonWorkflowOutput.toJson(result)

}
Loading
Loading