--- a/tests/test-lock.py Tue Oct 06 15:55:50 2015 -0700
+++ b/tests/test-lock.py Tue Oct 06 13:13:31 2015 -0700
@@ -8,6 +8,7 @@
import unittest
from mercurial import (
+ error,
lock,
scmutil,
)
@@ -250,5 +251,21 @@
parentlock.release()
+ def testinheritcheck(self):
+ d = tempfile.mkdtemp(dir=os.getcwd())
+ state = teststate(self, d)
+ def check():
+ raise error.LockInheritanceContractViolation('check failed')
+ lock = state.makelock(inheritchecker=check)
+ state.assertacquirecalled(True)
+
+ def tryinherit():
+ with lock.inherit() as lockname:
+ pass
+
+ self.assertRaises(error.LockInheritanceContractViolation, tryinherit)
+
+ lock.release()
+
if __name__ == '__main__':
silenttestrunner.main(__name__)