File tree Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Expand file tree Collapse file tree 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 11import os
22import json
3+ import glob
34import requests
45import urllib
56import logging
@@ -90,6 +91,13 @@ def fixpaths(d):
9091 visit (input_dict , fixpaths )
9192
9293
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+
93101def wes_reponse (postresult ):
94102 if postresult .status_code != 200 :
95103 logging .error ("%s" , json .loads (postresult .text ))
Original file line number Diff line number Diff line change 88import logging
99import requests
1010from 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
1212
1313
1414def main (argv = sys .argv [1 :]):
@@ -87,6 +87,7 @@ def main(argv=sys.argv[1:]):
8787 logging .basicConfig (level = logging .INFO )
8888
8989 args .attachments = args .attachments if not args .attachments else args .attachments .split (',' )
90+ args .attachments = list (expand_globs (args .attachments ))
9091 r = client .run (args .workflow_url , args .job_order , args .attachments )
9192
9293 if args .wait :
You can’t perform that action at this time.
0 commit comments