##// END OF EJS Templates
test-lock.py: move temp dir generation to testcase...
Siddharth Agarwal -
r26382:b673e89a default
parent child Browse files
Show More
@@ -13,13 +13,12 b' from mercurial import ('
13 13 testlockname = 'testlock'
14 14
15 15 class teststate(object):
16 def __init__(self, testcase):
16 def __init__(self, testcase, dir):
17 17 self._testcase = testcase
18 18 self._acquirecalled = False
19 19 self._releasecalled = False
20 20 self._postreleasecalled = False
21 d = tempfile.mkdtemp(dir=os.getcwd())
22 self.vfs = scmutil.vfs(d, audit=False)
21 self.vfs = scmutil.vfs(dir, audit=False)
23 22
24 23 def makelock(self, *args, **kwargs):
25 24 l = lock.lock(self.vfs, testlockname, releasefn=self.releasefn,
@@ -86,7 +85,7 b' class teststate(object):'
86 85
87 86 class testlock(unittest.TestCase):
88 87 def testlock(self):
89 state = teststate(self)
88 state = teststate(self, tempfile.mkdtemp(dir=os.getcwd()))
90 89 lock = state.makelock()
91 90 state.assertacquirecalled(True)
92 91 lock.release()
@@ -95,7 +94,7 b' class testlock(unittest.TestCase):'
95 94 state.assertlockexists(False)
96 95
97 96 def testrecursivelock(self):
98 state = teststate(self)
97 state = teststate(self, tempfile.mkdtemp(dir=os.getcwd()))
99 98 lock = state.makelock()
100 99 state.assertacquirecalled(True)
101 100
@@ -115,7 +114,7 b' class testlock(unittest.TestCase):'
115 114 state.assertlockexists(False)
116 115
117 116 def testlockfork(self):
118 state = teststate(self)
117 state = teststate(self, tempfile.mkdtemp(dir=os.getcwd()))
119 118 lock = state.makelock()
120 119 state.assertacquirecalled(True)
121 120 lock.lock()
General Comments 0
You need to be logged in to leave comments. Login now