File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,19 @@ def tearDown(self):
2020
2121 def test_expand_globs (self ):
2222 """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 ' )
23+ files = subprocess .check_output (['ls' , '-1' , '.' ])
24+
25+ # python 2/3 bytestring/utf-8 compatibility
26+ if isinstance (files , str ):
27+ files = files .split ('\n ' )
28+ else :
29+ files = files .decode ('utf-8' ).split ('\n ' )
30+
2431 if '' in files :
2532 files .remove ('' )
33+ files = ['file://' + os .path .abspath (f ) for f in files ]
2634 glob_files = expand_globs ('*' )
27- assert set (files ) == glob_files
35+ assert set (files ) == glob_files , ' \n ' + str ( set ( files )) + ' \n ' + str ( glob_files )
2836
2937
3038if __name__ == '__main__' :
Original file line number Diff line number Diff line change @@ -94,7 +94,14 @@ def fixpaths(d):
9494def expand_globs (attachments ):
9595 expanded_list = []
9696 for filepath in attachments :
97- expanded_list += glob .glob (filepath )
97+ if 'file://' in filepath :
98+ for f in glob .glob (filepath [7 :]):
99+ expanded_list += ['file://' + os .path .abspath (f )]
100+ elif ':' not in filepath :
101+ for f in glob .glob (filepath ):
102+ expanded_list += ['file://' + os .path .abspath (f )]
103+ else :
104+ expanded_list += [filepath ]
98105 return set (expanded_list )
99106
100107
You can’t perform that action at this time.
0 commit comments