Skip to content

Commit d05b78b

Browse files
author
Peter Amstutz
committed
Add test
1 parent 1a04179 commit d05b78b

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

tests/test_toolargparse.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
import pytest
55
from cwltool.main import main
6+
import cwltool.executors
67

78
from .util import get_data, needs_docker
89

9-
1010
script_a = '''
1111
#!/usr/bin/env cwl-runner
1212
cwlVersion: v1.0
@@ -94,3 +94,38 @@ def test_argparse(name, script_contents, params, tmpdir):
9494
finally:
9595
if script and script.name and os.path.exists(script.name):
9696
os.unlink(script.name)
97+
98+
99+
class NoopJobExecutor(cwltool.executors.JobExecutor):
100+
def run_jobs(self,
101+
process, # type: Process
102+
job_order_object, # type: Dict[Text, Any]
103+
logger, # type: logging.Logger
104+
runtime_context # type: RuntimeContext
105+
): # type: (...) -> None
106+
pass
107+
108+
def execute(self,
109+
process, # type: Process
110+
job_order_object, # type: Dict[Text, Any]
111+
runtime_context, # type: RuntimeContext
112+
logger=None, # type: logging.Logger
113+
): # type: (...) -> Tuple[Optional[Union[Dict[Text, Any], List[Dict[Text, Any]]]], Text]
114+
return {}, "success"
115+
116+
def test_dont_require_inputs():
117+
script = None
118+
try:
119+
script = NamedTemporaryFile(mode='w', delete=False)
120+
script.write(script_a)
121+
script.close()
122+
123+
assert main(argsl=[script.name, "--input", script.name], executor=NoopJobExecutor()) == 0
124+
assert main(argsl=[script.name], executor=NoopJobExecutor()) == 2
125+
assert main(argsl=[script.name], executor=NoopJobExecutor(), input_required=False) == 0
126+
127+
except SystemExit as err:
128+
assert err.code == 0, name
129+
finally:
130+
if script and script.name and os.path.exists(script.name):
131+
os.unlink(script.name)

0 commit comments

Comments
 (0)