Skip to content

Commit 7ade479

Browse files
committed
maintenance: remove unittest from test_http_input
1 parent a19271c commit 7ade479

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

tests/test_http_input.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
1-
from __future__ import absolute_import
2-
31
import os
42
import tempfile
5-
import unittest
63

74
from cwltool.pathmapper import PathMapper
85

96

10-
class TestHttpInput(unittest.TestCase):
11-
def test_http_path_mapping(self):
12-
class SubPathMapper(PathMapper):
13-
def __init__(self, referenced_files, basedir, stagedir):
14-
super(SubPathMapper, self).__init__(referenced_files, basedir, stagedir)
15-
input_file_path = "https://raw.githubusercontent.com/common-workflow-language/cwltool/master/tests/2.fasta"
16-
tempdir = tempfile.mkdtemp()
17-
base_file = [{
18-
"class": "File",
19-
"location": "https://raw.githubusercontent.com/common-workflow-language/cwltool/master/tests/2.fasta",
20-
"basename": "chr20.fa"
21-
}]
22-
path_map_obj = SubPathMapper(base_file, os.getcwd(), tempdir)
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()
2325

24-
self.assertIn(input_file_path,path_map_obj._pathmap)
25-
assert os.path.exists(path_map_obj._pathmap[input_file_path].resolved) == 1
26-
with open(path_map_obj._pathmap[input_file_path].resolved) as f:
27-
self.assertIn(">Sequence 561 BP; 135 A; 106 C; 98 G; 222 T; 0 other;",f.read())
28-
f.close()
26+
assert ">Sequence 561 BP; 135 A; 106 C; 98 G; 222 T; 0 other;" in contents

0 commit comments

Comments
 (0)