Show More
@@ -2,19 +2,19 from __future__ import absolute_import | |||||
2 |
|
2 | |||
3 | import copy |
|
3 | import copy | |
4 | import errno |
|
4 | import errno | |
5 | import os |
|
|||
6 | import silenttestrunner |
|
5 | import silenttestrunner | |
7 | import tempfile |
|
6 | import tempfile | |
8 | import types |
|
7 | import types | |
9 | import unittest |
|
8 | import unittest | |
10 |
|
9 | |||
11 | from mercurial import ( |
|
10 | from mercurial import ( | |
|
11 | encoding, | |||
12 | error, |
|
12 | error, | |
13 | lock, |
|
13 | lock, | |
14 | vfs as vfsmod, |
|
14 | vfs as vfsmod, | |
15 | ) |
|
15 | ) | |
16 |
|
16 | |||
17 | testlockname = 'testlock' |
|
17 | testlockname = b'testlock' | |
18 |
|
18 | |||
19 | # work around http://bugs.python.org/issue1515 |
|
19 | # work around http://bugs.python.org/issue1515 | |
20 | if types.MethodType not in copy._deepcopy_dispatch: |
|
20 | if types.MethodType not in copy._deepcopy_dispatch: | |
@@ -106,7 +106,7 class teststate(object): | |||||
106 |
|
106 | |||
107 | class testlock(unittest.TestCase): |
|
107 | class testlock(unittest.TestCase): | |
108 | def testlock(self): |
|
108 | def testlock(self): | |
109 |
state = teststate(self, tempfile.mkdtemp(dir= |
|
109 | state = teststate(self, tempfile.mkdtemp(dir=encoding.getcwd())) | |
110 | lock = state.makelock() |
|
110 | lock = state.makelock() | |
111 | state.assertacquirecalled(True) |
|
111 | state.assertacquirecalled(True) | |
112 | lock.release() |
|
112 | lock.release() | |
@@ -115,7 +115,7 class testlock(unittest.TestCase): | |||||
115 | state.assertlockexists(False) |
|
115 | state.assertlockexists(False) | |
116 |
|
116 | |||
117 | def testrecursivelock(self): |
|
117 | def testrecursivelock(self): | |
118 |
state = teststate(self, tempfile.mkdtemp(dir= |
|
118 | state = teststate(self, tempfile.mkdtemp(dir=encoding.getcwd())) | |
119 | lock = state.makelock() |
|
119 | lock = state.makelock() | |
120 | state.assertacquirecalled(True) |
|
120 | state.assertacquirecalled(True) | |
121 |
|
121 | |||
@@ -135,7 +135,7 class testlock(unittest.TestCase): | |||||
135 | state.assertlockexists(False) |
|
135 | state.assertlockexists(False) | |
136 |
|
136 | |||
137 | def testlockfork(self): |
|
137 | def testlockfork(self): | |
138 |
state = teststate(self, tempfile.mkdtemp(dir= |
|
138 | state = teststate(self, tempfile.mkdtemp(dir=encoding.getcwd())) | |
139 | lock = state.makelock() |
|
139 | lock = state.makelock() | |
140 | state.assertacquirecalled(True) |
|
140 | state.assertacquirecalled(True) | |
141 |
|
141 | |||
@@ -154,7 +154,7 class testlock(unittest.TestCase): | |||||
154 | state.assertlockexists(False) |
|
154 | state.assertlockexists(False) | |
155 |
|
155 | |||
156 | def testinheritlock(self): |
|
156 | def testinheritlock(self): | |
157 |
d = tempfile.mkdtemp(dir= |
|
157 | d = tempfile.mkdtemp(dir=encoding.getcwd()) | |
158 | parentstate = teststate(self, d) |
|
158 | parentstate = teststate(self, d) | |
159 | parentlock = parentstate.makelock() |
|
159 | parentlock = parentstate.makelock() | |
160 | parentstate.assertacquirecalled(True) |
|
160 | parentstate.assertacquirecalled(True) | |
@@ -184,7 +184,7 class testlock(unittest.TestCase): | |||||
184 | parentstate.assertlockexists(False) |
|
184 | parentstate.assertlockexists(False) | |
185 |
|
185 | |||
186 | def testmultilock(self): |
|
186 | def testmultilock(self): | |
187 |
d = tempfile.mkdtemp(dir= |
|
187 | d = tempfile.mkdtemp(dir=encoding.getcwd()) | |
188 | state0 = teststate(self, d) |
|
188 | state0 = teststate(self, d) | |
189 | lock0 = state0.makelock() |
|
189 | lock0 = state0.makelock() | |
190 | state0.assertacquirecalled(True) |
|
190 | state0.assertacquirecalled(True) | |
@@ -225,7 +225,7 class testlock(unittest.TestCase): | |||||
225 | lock0.release() |
|
225 | lock0.release() | |
226 |
|
226 | |||
227 | def testinheritlockfork(self): |
|
227 | def testinheritlockfork(self): | |
228 |
d = tempfile.mkdtemp(dir= |
|
228 | d = tempfile.mkdtemp(dir=encoding.getcwd()) | |
229 | parentstate = teststate(self, d) |
|
229 | parentstate = teststate(self, d) | |
230 | parentlock = parentstate.makelock() |
|
230 | parentlock = parentstate.makelock() | |
231 | parentstate.assertacquirecalled(True) |
|
231 | parentstate.assertacquirecalled(True) | |
@@ -253,7 +253,7 class testlock(unittest.TestCase): | |||||
253 | parentlock.release() |
|
253 | parentlock.release() | |
254 |
|
254 | |||
255 | def testinheritcheck(self): |
|
255 | def testinheritcheck(self): | |
256 |
d = tempfile.mkdtemp(dir= |
|
256 | d = tempfile.mkdtemp(dir=encoding.getcwd()) | |
257 | state = teststate(self, d) |
|
257 | state = teststate(self, d) | |
258 | def check(): |
|
258 | def check(): | |
259 | raise error.LockInheritanceContractViolation('check failed') |
|
259 | raise error.LockInheritanceContractViolation('check failed') | |
@@ -273,7 +273,7 class testlock(unittest.TestCase): | |||||
273 | retrying 5 times. |
|
273 | retrying 5 times. | |
274 | """ |
|
274 | """ | |
275 |
|
275 | |||
276 |
d = tempfile.mkdtemp(dir= |
|
276 | d = tempfile.mkdtemp(dir=encoding.getcwd()) | |
277 | state = teststate(self, d) |
|
277 | state = teststate(self, d) | |
278 |
|
278 | |||
279 | def emulatefrequentlock(*args): |
|
279 | def emulatefrequentlock(*args): |
General Comments 0
You need to be logged in to leave comments.
Login now