Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/cwltool/tests/test_js_sandbox.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4f3585e2f14b |
---|---|
1 from typing import Any | |
2 | |
3 import pytest | |
4 | |
5 from cwltool import sandboxjs | |
6 from cwltool.utils import onWindows | |
7 | |
8 from .util import get_data, get_windows_safe_factory, windows_needs_docker | |
9 | |
10 node_versions = [ | |
11 ("v0.8.26\n", False), | |
12 ("v0.10.25\n", False), | |
13 ("v0.10.26\n", True), | |
14 ("v4.4.2\n", True), | |
15 ("v7.7.3\n", True), | |
16 ] | |
17 | |
18 | |
19 @pytest.mark.parametrize("version,supported", node_versions) | |
20 def test_node_version(version: str, supported: bool, mocker: Any) -> None: | |
21 mocked_subprocess = mocker.patch("cwltool.sandboxjs.subprocess") | |
22 mocked_subprocess.check_output = mocker.Mock(return_value=version) | |
23 | |
24 assert sandboxjs.check_js_threshold_version("node") == supported | |
25 | |
26 | |
27 @windows_needs_docker | |
28 def test_value_from_two_concatenated_expressions() -> None: | |
29 factory = get_windows_safe_factory() | |
30 echo = factory.make(get_data("tests/wf/vf-concat.cwl")) | |
31 file = {"class": "File", "location": get_data("tests/wf/whale.txt")} | |
32 | |
33 assert echo(file1=file) == {"out": "a string\n"} | |
34 | |
35 | |
36 @pytest.mark.skipif( | |
37 onWindows(), reason="Caching processes for windows is not supported." | |
38 ) | |
39 def test_caches_js_processes(mocker: Any) -> None: | |
40 sandboxjs.exec_js_process("7", context="{}") | |
41 | |
42 mocked_new_js_proc = mocker.patch("cwltool.sandboxjs.new_js_proc") | |
43 sandboxjs.exec_js_process("7", context="{}") | |
44 | |
45 mocked_new_js_proc.assert_not_called() |