MCPcopy
hub / github.com/redis/redis-py / test_context_manager

Method test_context_manager

tests/test_lock.py:133–138  ·  view source on GitHub ↗
(self, r)

Source from the content-addressed store, hash-verified

131 lock1.release()
132
133 def test_context_manager(self, r):
134 # blocking_timeout prevents a deadlock if the lock can't be acquired
135 # for some reason
136 with self.get_lock(r, "foo", blocking_timeout=0.2) as lock:
137 assert r.get("foo") == lock.local.token
138 assert r.get("foo") is None
139
140 def test_context_manager_blocking_timeout(self, r, fake_lock_time):
141 with self.get_lock(r, "foo", blocking=False):

Callers

nothing calls this directly

Calls 2

get_lockMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected