Ejemplo n.º 1
0
        def testD(self):
            lock = Lock()
            lock.acquire()
            lock.release()

            fut = lock.acquire()
            assert fut.done()
Ejemplo n.º 2
0
        def testReleasingUnlockedLockRaises(self):
            lock = Lock()

            with pytest.raises(RuntimeError):
                lock.release()
Ejemplo n.º 3
0
        def testSecondAcquireBlocks(self):
            lock = Lock()
            lock.acquire()

            fut = lock.acquire()
            assert not fut.done()
Ejemplo n.º 4
0
        def testFirstAcquirePasses(self):
            lock = Lock()

            fut = lock.acquire()
            assert fut.done()
Ejemplo n.º 5
0
        def testE(self):
            lock = Lock()
            lock.acquire()

            f1 = lock.acquire()
            assert not f1.done()
            lock.release()

            f2 = lock.acquire()
            assert not f2.done()

            lock.release()
            assert f1.done()

            lock.release()
            assert f2.done()