From e84337e73757617163b2adbf698f8616607c0917 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Mon, 24 Jan 2022 13:10:33 +0100 Subject: [PATCH 1/2] "when" expressions get an empty "self" variable --- cwltool/workflow_job.py | 1 - tests/test_conditionals.py | 19 +++++++++++++++++ tests/wf/conditional_step_no_inputs.cwl | 28 +++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 tests/test_conditionals.py create mode 100644 tests/wf/conditional_step_no_inputs.cwl diff --git a/cwltool/workflow_job.py b/cwltool/workflow_job.py index 24ca5cec8..bd195be9e 100644 --- a/cwltool/workflow_job.py +++ b/cwltool/workflow_job.py @@ -692,7 +692,6 @@ def valueFromFunc( None, None, {}, - context=cast(Optional[CWLObjectType], v), debug=runtimeContext.debug, js_console=runtimeContext.js_console, timeout=runtimeContext.eval_timeout, diff --git a/tests/test_conditionals.py b/tests/test_conditionals.py new file mode 100644 index 000000000..8665f1e3a --- /dev/null +++ b/tests/test_conditionals.py @@ -0,0 +1,19 @@ +"""Tests related to CWL v1.2+ "when" expressions and conditional handling.""" + +import json +import re + +from .util import get_data, get_main_output + + +def test_conditional_step_no_inputs() -> None: + """Confirm fix for bug that populated `self` object for `when` expressions.""" + err_code, stdout, stderr = get_main_output( + [ + get_data("tests/wf/conditional_step_no_inputs.cwl"), + ] + ) + result = json.loads(stdout)["required"] + stderr = re.sub(r"\s\s+", " ", stderr) + assert err_code == 0, stderr + assert result is None diff --git a/tests/wf/conditional_step_no_inputs.cwl b/tests/wf/conditional_step_no_inputs.cwl new file mode 100644 index 000000000..ed8240a10 --- /dev/null +++ b/tests/wf/conditional_step_no_inputs.cwl @@ -0,0 +1,28 @@ +#!/usr/bin/env cwl-runner +cwlVersion: v1.2 +class: Workflow + +requirements: + InlineJavascriptRequirement: {} + +inputs: [] + +steps: + step1: + in: {} + when: $(self !== null) + run: + class: ExpressionTool + inputs: [] + requirements: + InlineJavascriptRequirement: {} + expression: | + $({"result": "huzzah!"}) + outputs: + result: string + out: [ result ] + +outputs: + required: + type: string + outputSource: step1/result From 72915ca520b3887349118e2b4810bd7911307e6a Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Mon, 24 Jan 2022 13:38:39 +0100 Subject: [PATCH 2/2] codecov: wait for all others to finish before notifying --- .codecov.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000..b02c17ce9 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,3 @@ +codecov: + notify: + wait_for_ci: yes