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

"planemo upload commit 0a63dd5f4d38a1f6944587f52a8cd79874177fc1"
author shellac
date Thu, 14 May 2020 14:56:58 -0400
parents 26e78fe6e8c4
children
comparison
equal deleted inserted replaced
1:75ca89e9b81c 2:6af9afd405e9
1 import pytest
2
3 from distutils import spawn
4
5 from cwltool.docker import DockerCommandLineJob
6 from cwltool.main import main
7
8 from .util import get_data, get_main_output, needs_docker, needs_singularity
9
10 @needs_docker
11 def test_docker_workflow(tmpdir):
12 result_code, _, stderr = get_main_output(
13 ['--default-container', 'debian', '--outdir', str(tmpdir),
14 get_data("tests/wf/hello-workflow.cwl"), "--usermessage", "hello"])
15 assert "completed success" in stderr
16 assert result_code == 0
17
18 def test_docker_iwdr():
19 result_code = main(
20 ['--default-container', 'debian',
21 get_data("tests/wf/iwdr-entry.cwl"), "--message", "hello"])
22 docker_installed = bool(spawn.find_executable('docker'))
23 if docker_installed:
24 assert result_code == 0
25 else:
26 assert result_code != 0
27
28 @needs_docker
29 def test_docker_incorrect_image_pull():
30 result_code = main(
31 ['--default-container', 'non-existant-weird-image',
32 get_data("tests/wf/hello-workflow.cwl"), "--usermessage", "hello"])
33 assert result_code != 0
34
35 @needs_docker
36 def test_docker_file_mount():
37 # test for bug in
38 # ContainerCommandLineJob.create_file_and_add_volume()
39 #
40 # the bug was that it would use the file literal contents as the
41 # temporary file name, which can easily result in a file name that
42 # is too long or otherwise invalid. This test case uses ".."
43 result_code = main(
44 [get_data("tests/wf/literalfile.cwl"), get_data("tests/wf/literalfile-job.yml")])
45 assert result_code == 0