7
7
from testsuite .support import ROOT_DIR , PseudoFile
8
8
9
9
10
+ def safe_line_split (line ):
11
+ """ parses the path, from message details """
12
+
13
+ # On certain platforms, the drive notation conflicts
14
+ # with the message seperator, inducing problems during tuple unpacking.
15
+
16
+ split = line .split (':' )
17
+ if 'win' in sys .platform :
18
+ if len (split ) == 5 :
19
+ drive , path , x , y , msg = split
20
+ path = drive + ':' + path
21
+ elif len (split ) == 4 :
22
+ path , x , y , msg = split
23
+ else :
24
+ raise Exception ("Unhandled edge case parsing message: " + line )
25
+ else :
26
+ path , x , y , msg = split
27
+ return path , x , y , msg
28
+
29
+
10
30
class ShellTestCase (unittest .TestCase ):
11
31
"""Test the usual CLI options and output."""
12
32
@@ -77,7 +97,7 @@ def test_check_simple(self):
77
97
self .assertFalse (stderr )
78
98
self .assertEqual (len (stdout ), 17 )
79
99
for line , num , col in zip (stdout , (3 , 6 , 9 , 12 ), (3 , 6 , 1 , 5 )):
80
- path , x , y , msg = line . split ( ':' )
100
+ path , x , y , msg = safe_line_split ( line )
81
101
self .assertTrue (path .endswith (E11 ))
82
102
self .assertEqual (x , str (num ))
83
103
self .assertEqual (y , str (col ))
@@ -141,7 +161,7 @@ def test_check_diff(self):
141
161
self .assertEqual (errcode , 1 )
142
162
self .assertFalse (stderr )
143
163
for line , num , col in zip (stdout , (3 , 6 ), (3 , 6 )):
144
- path , x , y , msg = line . split ( ':' )
164
+ path , x , y , msg = safe_line_split ( line )
145
165
self .assertEqual (x , str (num ))
146
166
self .assertEqual (y , str (col ))
147
167
self .assertTrue (msg .startswith (' E11' ))
@@ -154,7 +174,7 @@ def test_check_diff(self):
154
174
self .assertEqual (errcode , 1 )
155
175
self .assertFalse (stderr )
156
176
for line , num , col in zip (stdout , (3 , 6 ), (3 , 6 )):
157
- path , x , y , msg = line . split ( ':' )
177
+ path , x , y , msg = safe_line_split ( line )
158
178
self .assertEqual (x , str (num ))
159
179
self .assertEqual (y , str (col ))
160
180
self .assertTrue (msg .startswith (' E11' ))
0 commit comments