Example #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()]
Example #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()]
Example #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()]
Example #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()]