def METHOD_NAME(self):
    # PID and hostname are parsed and logged from lock file on failure
    with patch('os.getpid', Mock(return_value=123)):
        with patch('socket.gethostname', Mock(return_value='myhostname')):
            lock = zc.lockfile.LockFile('f.lock',
                                        content_template='{pid}/{hostname}')
            with open('f.lock') as f:
                self.assertEqual(' 123/myhostname\n', f.read())
            lock.close()