comparison planemo/lib/python3.7/site-packages/cwltool/tests/test_http_input.py @ 0:d30785e31577 draft

"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author guerler
date Fri, 31 Jul 2020 00:18:57 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d30785e31577
1 import os
2 import tempfile
3
4 from cwltool.pathmapper import PathMapper
5
6
7 def test_http_path_mapping():
8 class SubPathMapper(PathMapper):
9 def __init__(self, referenced_files, basedir, stagedir):
10 super(SubPathMapper, self).__init__(referenced_files, basedir, stagedir)
11 input_file_path = "https://raw.githubusercontent.com/common-workflow-language/cwltool/master/tests/2.fasta"
12 tempdir = tempfile.mkdtemp()
13 base_file = [{
14 "class": "File",
15 "location": "https://raw.githubusercontent.com/common-workflow-language/cwltool/master/tests/2.fasta",
16 "basename": "chr20.fa"
17 }]
18 pathmap = SubPathMapper(base_file, os.getcwd(), tempdir)._pathmap
19
20 assert input_file_path in pathmap
21 assert os.path.exists(pathmap[input_file_path].resolved)
22
23 with open(pathmap[input_file_path].resolved) as file:
24 contents = file.read()
25
26 assert ">Sequence 561 BP; 135 A; 106 C; 98 G; 222 T; 0 other;" in contents