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) with self.assertRaises(error.LockInheritanceContractViolation): with lock.inherit(): pass lock.release()
def tryinherit(): with lock.inherit(): pass