File tree 3 files changed +41
-1
lines changed
3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change
1
+ from __future__ import absolute_import
2
+
3
+ import unittest
4
+ import os
5
+ import logging
6
+ import subprocess
7
+
8
+ from wes_client .util import expand_globs
9
+
10
+ logging .basicConfig (level = logging .INFO )
11
+
12
+
13
+ class IntegrationTest (unittest .TestCase ):
14
+ def setUp (self ):
15
+ dirname , filename = os .path .split (os .path .abspath (__file__ ))
16
+ self .testdata_dir = dirname + 'data'
17
+
18
+ def tearDown (self ):
19
+ unittest .TestCase .tearDown (self )
20
+
21
+ def test_expand_globs (self ):
22
+ """Asserts that wes_client.expand_globs() sees the same files in the cwd as 'ls'."""
23
+ files = subprocess .check_output (['ls' , '-1' , '.' ]).decode ('utf-8' ).split ('\n ' )
24
+ if '' in files :
25
+ files .remove ('' )
26
+ glob_files = expand_globs ('*' )
27
+ assert set (files ) == glob_files
28
+
29
+
30
+ if __name__ == '__main__' :
31
+ unittest .main () # run all tests
Original file line number Diff line number Diff line change 1
1
import os
2
2
import json
3
+ import glob
3
4
import requests
4
5
import urllib
5
6
import logging
@@ -90,6 +91,13 @@ def fixpaths(d):
90
91
visit (input_dict , fixpaths )
91
92
92
93
94
+ def expand_globs (attachments ):
95
+ expanded_list = []
96
+ for filepath in attachments :
97
+ expanded_list += glob .glob (filepath )
98
+ return set (expanded_list )
99
+
100
+
93
101
def wes_reponse (postresult ):
94
102
if postresult .status_code != 200 :
95
103
logging .error ("%s" , json .loads (postresult .text ))
Original file line number Diff line number Diff line change 8
8
import logging
9
9
import requests
10
10
from requests .exceptions import InvalidSchema , MissingSchema
11
- from wes_client .util import modify_jsonyaml_paths , WESClient
11
+ from wes_client .util import modify_jsonyaml_paths , expand_globs , WESClient
12
12
13
13
14
14
def main (argv = sys .argv [1 :]):
@@ -87,6 +87,7 @@ def main(argv=sys.argv[1:]):
87
87
logging .basicConfig (level = logging .INFO )
88
88
89
89
args .attachments = args .attachments if not args .attachments else args .attachments .split (',' )
90
+ args .attachments = list (expand_globs (args .attachments ))
90
91
r = client .run (args .workflow_url , args .job_order , args .attachments )
91
92
92
93
if args .wait :
You can’t perform that action at this time.
0 commit comments