Ejemplo n.º 1
0
 def release(self):
     logging.debug("Releasing lock on %s", self.path)
     if self.i_am_locking:
         fcntl.flock(self.lock_file.fileno(), fcntl.LOCK_UN)
         self._has_lock = False
     else:
         raise lockfile.NotLocked()
     logging.debug("Unlocked %s", self.path)
Ejemplo n.º 2
0
 def mock_release():
     if scenario['locking_pid'] is None:
         raise lockfile.NotLocked()
     if scenario['locking_pid'] != scenario['pid']:
         raise lockfile.NotMyLock()
     scenario['locking_pid'] = None