diff env/lib/python3.7/site-packages/cwltool/tests/test_iwdr.py @ 2:6af9afd405e9 draft

"planemo upload commit 0a63dd5f4d38a1f6944587f52a8cd79874177fc1"
author shellac
date Thu, 14 May 2020 14:56:58 -0400
parents 26e78fe6e8c4
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/env/lib/python3.7/site-packages/cwltool/tests/test_iwdr.py	Thu May 14 14:56:58 2020 -0400
@@ -0,0 +1,129 @@
+import tempfile
+import os
+from cwltool.main import main
+from cwltool import load_tool
+from .util import (get_data, get_windows_safe_factory, windows_needs_docker,
+                   needs_docker, temp_dir, needs_singularity, get_main_output)
+
+@windows_needs_docker
+def test_newline_in_entry():
+    """Files in a InitialWorkingDirectory are created with a newline character."""
+    factory = get_windows_safe_factory()
+    echo = factory.make(get_data("tests/wf/iwdr-entry.cwl"))
+    assert echo(message="hello") == {"out": "CONFIGVAR=hello\n"}
+
+
+@needs_docker
+def test_empty_file_creation():
+    """An empty file can be created in InitialWorkingDirectory."""
+    err_code, _, _ = get_main_output([get_data("tests/wf/iwdr-empty.cwl")])
+    assert err_code == 0
+
+
+@needs_docker
+def test_iwdr_permutations():
+    saved_tempdir = tempfile.tempdir
+    with temp_dir() as misc:
+        tempfile.tempdir = os.path.realpath(misc)
+        with temp_dir() as fifth:
+    	    with temp_dir() as sixth:
+    	        with temp_dir() as seventh:
+    	            with temp_dir() as eighth:
+    	                with tempfile.NamedTemporaryFile() as first:
+    	                    with tempfile.NamedTemporaryFile() as second:
+    	                        with tempfile.NamedTemporaryFile() as third:
+    	                            with tempfile.NamedTemporaryFile() as fourth:
+    	                                with temp_dir() as outdir:
+    	                                    assert(main(
+    	                                        ['--outdir', outdir,
+    	                                         get_data("tests/wf/iwdr_permutations.cwl"),
+    	                                         '--first', first.name,
+    	                                         '--second', second.name,
+    	                                         '--third', third.name,
+    	                                         '--fourth', fourth.name,
+    	                                         '--fifth', fifth,
+    	                                         '--sixth', sixth,
+    	                                         '--seventh', seventh,
+    	                                         '--eighth', eighth]) == 0)
+    tempfile.tempdir = saved_tempdir
+
+@needs_docker
+def test_iwdr_permutations_inplace():
+    saved_tempdir = tempfile.tempdir
+    with temp_dir() as misc:
+        tempfile.tempdir = os.path.realpath(misc)
+        with temp_dir() as fifth:
+            with temp_dir() as sixth:
+                with temp_dir() as seventh:
+                    with temp_dir() as eighth:
+                        with tempfile.NamedTemporaryFile() as first:
+                            with tempfile.NamedTemporaryFile() as second:
+                                with tempfile.NamedTemporaryFile() as third:
+                                    with tempfile.NamedTemporaryFile() as fourth:
+                                        with temp_dir() as outdir:
+                                            assert(main(
+                                                ['--outdir', outdir,
+                                                 '--enable-ext',
+                                                 '--overrides',
+                                                 get_data("tests/wf/iwdr_permutations_inplace.yml"),
+                                                 get_data("tests/wf/iwdr_permutations.cwl"),
+                                                 '--first', first.name,
+                                                 '--second', second.name,
+                                                 '--third', third.name,
+                                                 '--fourth', fourth.name,
+                                                 '--fifth', fifth,
+                                                 '--sixth', sixth,
+                                                 '--seventh', seventh,
+                                                 '--eighth', eighth]) == 0)
+    tempfile.tempdir = saved_tempdir
+
+@needs_singularity
+def test_iwdr_permutations_singularity():
+    with temp_dir() as fifth:
+        with temp_dir() as sixth:
+            with temp_dir() as seventh:
+                with temp_dir() as eighth:
+                    with tempfile.NamedTemporaryFile() as first:
+                        with tempfile.NamedTemporaryFile() as second:
+                            with tempfile.NamedTemporaryFile() as third:
+                                with tempfile.NamedTemporaryFile() as fourth:
+                                    with temp_dir() as outdir:
+                                        assert(main(
+                                            ['--outdir', outdir,
+                                             '--singularity',
+                                             get_data("tests/wf/iwdr_permutations.cwl"),
+                                             '--first', first.name,
+                                             '--second', second.name,
+                                             '--third', third.name,
+                                             '--fourth', fourth.name,
+                                             '--fifth', fifth,
+                                             '--sixth', sixth,
+                                             '--seventh', seventh,
+                                             '--eighth', eighth]) == 0)
+
+@needs_singularity
+def test_iwdr_permutations_singularity_inplace():
+    with temp_dir() as fifth:
+        with temp_dir() as sixth:
+            with temp_dir() as seventh:
+                with temp_dir() as eighth:
+                    with tempfile.NamedTemporaryFile() as first:
+                        with tempfile.NamedTemporaryFile() as second:
+                            with tempfile.NamedTemporaryFile() as third:
+                                with tempfile.NamedTemporaryFile() as fourth:
+                                    with temp_dir() as outdir:
+                                        assert(main(
+                                            ['--outdir', outdir,
+                                             '--singularity',
+                                             '--enable-ext',
+                                             '--overrides',
+                                             get_data("tests/wf/iwdr_permutations_inplace.yml"),
+                                             get_data("tests/wf/iwdr_permutations.cwl"),
+                                             '--first', first.name,
+                                             '--second', second.name,
+                                             '--third', third.name,
+                                             '--fourth', fourth.name,
+                                             '--fifth', fifth,
+                                             '--sixth', sixth,
+                                             '--seventh', seventh,
+                                             '--eighth', eighth]) == 0)