test-lock.py: allow PID to be changed in test state
This will be used in upcoming patches to create locks that appear as if they're
being created by child processes.
--- a/tests/test-lock.py Thu Sep 24 20:22:59 2015 -0700
+++ b/tests/test-lock.py Thu Sep 24 20:40:00 2015 -0700
@@ -22,16 +22,18 @@
return os.getpid() + self._pidoffset
class teststate(object):
- def __init__(self, testcase, dir):
+ def __init__(self, testcase, dir, pidoffset=0):
self._testcase = testcase
self._acquirecalled = False
self._releasecalled = False
self._postreleasecalled = False
self.vfs = scmutil.vfs(dir, audit=False)
+ self._pidoffset = pidoffset
def makelock(self, *args, **kwargs):
- l = lock.lock(self.vfs, testlockname, releasefn=self.releasefn,
- acquirefn=self.acquirefn, *args, **kwargs)
+ l = lockwrapper(self._pidoffset, self.vfs, testlockname,
+ releasefn=self.releasefn, acquirefn=self.acquirefn,
+ *args, **kwargs)
l.postrelease.append(self.postreleasefn)
return l