Exemplo n.º 1
0
    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())
Exemplo n.º 2
0
 def test_acquire_withcontext(self):
     lock = PIDLock(self.lockfile)
     with lock.acquire():
         self.assertTrue(lock.check())
     self.assertFalse(lock.check())
Exemplo n.º 3
0
 def test_release(self):
     lock = PIDLock(self.lockfile)
     lock.acquire()
     lock.release()
     self.assertFalse(lock.check())
Exemplo n.º 4
0
 def test_acquire_again(self):
     lock = PIDLock(self.lockfile)
     with lock.acquire():
         self.assertRaises(PIDLockException, lock.acquire)
Exemplo n.º 5
0
 def test_acquire(self):
     lock = PIDLock(self.lockfile)
     lock.acquire()
     self.assertTrue(lock.check())