Exemple #1
0
 def test_blocking_acquire(self):
     lock = TimeoutableLock()
     self.assert_(lock.acquire())
     t = AcquireWithTimeout(lock, None)
     t.start()
     lock.release()
     t.join()
     self.failIf(lock.acquire(False))
 def test_blocking_acquire(self):
     lock = TimeoutableLock()
     self.assert_(lock.acquire())
     t = AcquireWithTimeout(lock, None)
     t.start()
     lock.release()
     t.join()
     self.failIf(lock.acquire(False))
Exemple #3
0
    def test_acquire_early(self):
        lock = TimeoutableLock()
        self.assert_(lock.acquire())
        t = AcquireWithTimeout(lock, 10)

        before = time.time()
        t.start()
        lock.release()
        t.join()
        self.assert_(time.time() - before < 1)
        self.failIf(lock.acquire(False))
Exemple #4
0
    def test_basic(self):
        lock = TimeoutableLock()

        self.assert_(lock.acquire())
        self.failIf(lock.acquire(False))

        lock.release()
        self.assert_(lock.acquire())

        lock.release()
        self.assertRaises(RuntimeError, lock.release)
    def test_acquire_early(self):
        lock = TimeoutableLock()
        self.assert_(lock.acquire())
        t = AcquireWithTimeout(lock, 10)

        before = time.time()
        t.start()
        lock.release()
        t.join()
        self.assert_(time.time() - before < 1)
        self.failIf(lock.acquire(False))
    def test_basic(self):
        lock = TimeoutableLock()

        self.assert_(lock.acquire())
        self.failIf(lock.acquire(False))

        lock.release()
        self.assert_(lock.acquire())

        lock.release()
        self.assertRaises(RuntimeError, lock.release)