77from  testsuite .support  import  ROOT_DIR , PseudoFile 
88
99
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+ 
1030class  ShellTestCase (unittest .TestCase ):
1131    """Test the usual CLI options and output.""" 
1232
@@ -77,7 +97,7 @@ def test_check_simple(self):
7797        self .assertFalse (stderr )
7898        self .assertEqual (len (stdout ), 17 )
7999        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 )
81101            self .assertTrue (path .endswith (E11 ))
82102            self .assertEqual (x , str (num ))
83103            self .assertEqual (y , str (col ))
@@ -141,7 +161,7 @@ def test_check_diff(self):
141161        self .assertEqual (errcode , 1 )
142162        self .assertFalse (stderr )
143163        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 )
145165            self .assertEqual (x , str (num ))
146166            self .assertEqual (y , str (col ))
147167            self .assertTrue (msg .startswith (' E11' ))
@@ -154,7 +174,7 @@ def test_check_diff(self):
154174        self .assertEqual (errcode , 1 )
155175        self .assertFalse (stderr )
156176        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 )
158178            self .assertEqual (x , str (num ))
159179            self .assertEqual (y , str (col ))
160180            self .assertTrue (msg .startswith (' E11' ))
0 commit comments