9
9
import sys
10
10
import tempfile
11
11
import time
12
- from unittest import mock , skipIf
12
+ from unittest import mock , skipUnless
13
13
from datetime import datetime
14
14
15
- import pytest
16
15
import ddt
16
+ import pytest
17
17
18
18
from git .cmd import dashify
19
19
from git .compat import is_win
@@ -85,17 +85,26 @@ def setup(self):
85
85
"array" : [42 ],
86
86
}
87
87
88
- @skipIf (not is_win , "Paths specifically for Windows." )
88
+ # FIXME: Mark only the /proc-prefixing cases xfail, somehow (or fix them).
89
+ @pytest .mark .xfail (
90
+ reason = "Many return paths prefixed /proc/cygdrive instead." ,
91
+ raises = AssertionError ,
92
+ )
93
+ @skipUnless (sys .platform == "cygwin" , "Paths specifically for Cygwin." )
89
94
@ddt .idata (_norm_cygpath_pairs + _unc_cygpath_pairs )
90
95
def test_cygpath_ok (self , case ):
91
96
wpath , cpath = case
92
97
cwpath = cygpath (wpath )
93
98
self .assertEqual (cwpath , cpath , wpath )
94
99
95
- @skipIf (not is_win , "Paths specifically for Windows." )
100
+ @pytest .mark .xfail (
101
+ reason = r'2nd example r".\bar" -> "bar" fails, returns "./bar"' ,
102
+ raises = AssertionError ,
103
+ )
104
+ @skipUnless (sys .platform == "cygwin" , "Paths specifically for Cygwin." )
96
105
@ddt .data (
97
106
(r"./bar" , "bar" ),
98
- (r".\bar" , "bar" ),
107
+ (r".\bar" , "bar" ), # FIXME: Mark only this one xfail, somehow (or fix it).
99
108
(r"../bar" , "../bar" ),
100
109
(r"..\bar" , "../bar" ),
101
110
(r"../bar/.\foo/../chu" , "../bar/chu" ),
@@ -105,7 +114,7 @@ def test_cygpath_norm_ok(self, case):
105
114
cwpath = cygpath (wpath )
106
115
self .assertEqual (cwpath , cpath or wpath , wpath )
107
116
108
- @skipIf ( not is_win , "Paths specifically for Windows ." )
117
+ @skipUnless ( sys . platform == "cygwin" , "Paths specifically for Cygwin ." )
109
118
@ddt .data (
110
119
r"C:" ,
111
120
r"C:Relative" ,
@@ -118,7 +127,7 @@ def test_cygpath_invalids(self, wpath):
118
127
cwpath = cygpath (wpath )
119
128
self .assertEqual (cwpath , wpath .replace ("\\ " , "/" ), wpath )
120
129
121
- @skipIf ( not is_win , "Paths specifically for Windows ." )
130
+ @skipUnless ( sys . platform == "cygwin" , "Paths specifically for Cygwin ." )
122
131
@ddt .idata (_norm_cygpath_pairs )
123
132
def test_decygpath (self , case ):
124
133
wpath , cpath = case
@@ -156,11 +165,6 @@ def test_lock_file(self):
156
165
lock_file ._obtain_lock_or_raise ()
157
166
lock_file ._release_lock ()
158
167
159
- @pytest .mark .xfail (
160
- sys .platform == "cygwin" ,
161
- reason = "Cygwin fails here for some reason, always" ,
162
- raises = AssertionError ,
163
- )
164
168
def test_blocking_lock_file (self ):
165
169
my_file = tempfile .mktemp ()
166
170
lock_file = BlockingLockFile (my_file )
@@ -173,9 +177,8 @@ def test_blocking_lock_file(self):
173
177
self .assertRaises (IOError , wait_lock ._obtain_lock )
174
178
elapsed = time .time () - start
175
179
extra_time = 0.02
176
- if is_win :
177
- # for Appveyor
178
- extra_time *= 6 # NOTE: Indeterministic failures here...
180
+ if is_win or sys .platform == "cygwin" :
181
+ extra_time *= 6 # NOTE: Indeterministic failures without this...
179
182
self .assertLess (elapsed , wait_time + extra_time )
180
183
181
184
def test_user_id (self ):
0 commit comments