def test_cleanup_debris(self): with open(self.lockfile, 'w') as f: f.write('0') # Non existent pid lock = PIDLock(self.lockfile) lock.acquire() self.assertTrue(lock.check())
def test_acquire_withcontext(self): lock = PIDLock(self.lockfile) with lock.acquire(): self.assertTrue(lock.check()) self.assertFalse(lock.check())
def test_release(self): lock = PIDLock(self.lockfile) lock.acquire() lock.release() self.assertFalse(lock.check())
def test_acquire_again(self): lock = PIDLock(self.lockfile) with lock.acquire(): self.assertRaises(PIDLockException, lock.acquire)
def test_acquire(self): lock = PIDLock(self.lockfile) lock.acquire() self.assertTrue(lock.check())