comparison planemo/lib/python3.7/site-packages/cwltool/tests/test_js_sandbox.py @ 0:d30785e31577 draft

"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author guerler
date Fri, 31 Jul 2020 00:18:57 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d30785e31577
1 import pytest
2
3 from cwltool import sandboxjs
4 from cwltool.utils import onWindows
5
6 from .util import get_data, get_windows_safe_factory, windows_needs_docker
7
8
9 node_versions = [
10 (b'v0.8.26\n', False),
11 (b'v0.10.25\n', False),
12
13 (b'v0.10.26\n', True),
14 (b'v4.4.2\n', True),
15 (b'v7.7.3\n', True)
16 ]
17
18 @pytest.mark.parametrize('version,supported', node_versions)
19 def test_node_version(version, supported, mocker):
20 mocked_subprocess = mocker.patch("cwltool.sandboxjs.subprocess")
21 mocked_subprocess.check_output = mocker.Mock(return_value=version)
22
23 assert sandboxjs.check_js_threshold_version('node') == supported
24
25 @windows_needs_docker
26 def test_value_from_two_concatenated_expressions():
27 factory = get_windows_safe_factory()
28 echo = factory.make(get_data("tests/wf/vf-concat.cwl"))
29 file = {"class": "File",
30 "location": get_data("tests/wf/whale.txt")}
31
32 assert echo(file1=file) == {u"out": u"a string\n"}
33
34 @pytest.mark.skipif(onWindows(), reason="Caching processes for windows is not supported.")
35 def test_caches_js_processes(mocker):
36 sandboxjs.exec_js_process("7", context="{}")
37
38 mocked_new_js_proc = mocker.patch("cwltool.sandboxjs.new_js_proc")
39 sandboxjs.exec_js_process("7", context="{}")
40
41 mocked_new_js_proc.assert_not_called()