|
13 | 13 | from cwltool.builder import Builder
|
14 | 14 | from cwltool.command_line_tool import CommandLineTool, ExpressionTool
|
15 | 15 | from cwltool.context import LoadingContext, RuntimeContext
|
| 16 | +from cwltool.procgenerator import ProcessGenerator |
16 | 17 | from cwltool.stdfsaccess import StdFsAccess
|
17 | 18 | from cwltool.update import INTERNAL_VERSION
|
18 | 19 | from cwltool.workflow import Workflow
|
19 | 20 |
|
20 | 21 | from .test_anon_types import snippet
|
| 22 | +from .util import get_data |
21 | 23 |
|
22 | 24 |
|
23 | 25 | @pytest.mark.parametrize("snippet", snippet)
|
@@ -52,6 +54,35 @@ def test_pickle_unpickle_workflow(snippet: CommentedMap) -> None:
|
52 | 54 | assert pickle.loads(stream)
|
53 | 55 |
|
54 | 56 |
|
| 57 | +def test_pickle_processgenerator() -> None: |
| 58 | + """We can pickle ProcessGenerator.""" |
| 59 | + |
| 60 | + pytoolgen = get_data("tests/wf/generator/pytoolgen.cwl") |
| 61 | + a = ProcessGenerator( |
| 62 | + CommentedMap( |
| 63 | + { |
| 64 | + "cwlVersion": "v1.0", |
| 65 | + "id": f"file://{pytoolgen}", |
| 66 | + "$namespaces": {"cwltool": "http://commonwl.org/cwltool#"}, |
| 67 | + "class": "cwltool:ProcessGenerator", |
| 68 | + "inputs": {}, |
| 69 | + "outputs": {}, |
| 70 | + "run": { |
| 71 | + "id": f"file://{pytoolgen}#f9f617af-3088-4ade-bbf3-acd1d6f51355", |
| 72 | + "cwlVersion": "v1.0", |
| 73 | + "class": "CommandLineTool", |
| 74 | + "inputs": {}, |
| 75 | + "outputs": {}, |
| 76 | + "baseCommand": "echo", |
| 77 | + }, |
| 78 | + }, |
| 79 | + ), |
| 80 | + LoadingContext(), |
| 81 | + ) |
| 82 | + |
| 83 | + assert pickle.dumps(a) |
| 84 | + |
| 85 | + |
55 | 86 | def test_serialize_builder() -> None:
|
56 | 87 | """We can pickle Builder."""
|
57 | 88 | runtime_context = RuntimeContext()
|
|
0 commit comments