Ejemplo n.º 1
0
 def test_failure(self):
     lock_stub = pretend.stub(acquire=pretend.call_recorder(lambda: False))
     r = pretend.stub(lock=lambda *a, **kw: lock_stub)
     test_lock = SearchLock(r)
     with pytest.raises(redis.exceptions.LockError):
         test_lock.__enter__()
     assert lock_stub.acquire.calls == [pretend.call()]
Ejemplo n.º 2
0
 def test_failure(self):
     lock_stub = pretend.stub(acquire=pretend.call_recorder(lambda: False))
     r = pretend.stub(lock=lambda *a, **kw: lock_stub)
     test_lock = SearchLock(r)
     with pytest.raises(redis.exceptions.LockError):
         test_lock.__enter__()
     assert lock_stub.acquire.calls == [pretend.call()]
Ejemplo n.º 3
0
 def test_success(self):
     lock_stub = pretend.stub(acquire=pretend.call_recorder(lambda: True))
     r = pretend.stub(lock=lambda *a, **kw: lock_stub)
     test_lock = SearchLock(r)
     test_lock.__enter__()
     assert lock_stub.acquire.calls == [pretend.call()]
Ejemplo n.º 4
0
 def test_success(self):
     lock_stub = pretend.stub(acquire=pretend.call_recorder(lambda: True))
     r = pretend.stub(lock=lambda *a, **kw: lock_stub)
     test_lock = SearchLock(r)
     test_lock.__enter__()
     assert lock_stub.acquire.calls == [pretend.call()]