File: test_relax_path_checks.py

package info (click to toggle)
cwltool 1.0.20181217162649%2Bdfsg-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,632 kB
  • sloc: python: 11,008; makefile: 153; sh: 22
file content (43 lines) | stat: -rw-r--r-- 975 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
from tempfile import NamedTemporaryFile

from cwltool.main import main

from .util import needs_docker


script = '''
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
inputs:
  - id: input
    type: File
    inputBinding:
      position: 0
outputs:
  - id: output
    type: File
    outputBinding:
      glob: test.txt
stdout: test.txt
baseCommand: [cat]
'''

@needs_docker
def test_spaces_in_input_files(tmpdir):
    try:
        script_file = NamedTemporaryFile(mode='w', delete=False)
        script_file.write(script)
        script_file.flush()
        script_file.close()

        spaces = NamedTemporaryFile(prefix="test with spaces", delete=False)
        spaces.close()

        params = ["--debug", "--outdir", str(tmpdir), script_file.name, '--input', spaces.name]
        assert main(params) == 1
        assert main(["--relax-path-checks"] + params) == 0
    finally:
        os.remove(script_file.name)
        os.remove(spaces.name)