File tree 2 files changed +18
-3
lines changed
2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,19 @@ def tearDown(self):
20
20
21
21
def test_expand_globs (self ):
22
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 ' )
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
+
24
31
if '' in files :
25
32
files .remove ('' )
33
+ files = ['file://' + os .path .abspath (f ) for f in files ]
26
34
glob_files = expand_globs ('*' )
27
- assert set (files ) == glob_files
35
+ assert set (files ) == glob_files , ' \n ' + str ( set ( files )) + ' \n ' + str ( glob_files )
28
36
29
37
30
38
if __name__ == '__main__' :
Original file line number Diff line number Diff line change @@ -94,7 +94,14 @@ def fixpaths(d):
94
94
def expand_globs (attachments ):
95
95
expanded_list = []
96
96
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 ]
98
105
return set (expanded_list )
99
106
100
107
You can’t perform that action at this time.
0 commit comments