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

Method test_exec_error_raised

tests/test_pipeline.py:123–135  ·  view source on GitHub ↗
(self, r)

Source from the content-addressed store, hash-verified

121 assert r["z"] == b"zzz"
122
123 def test_exec_error_raised(self, r):
124 r["c"] = "a"
125 with r.pipeline() as pipe:
126 pipe.set("a", 1).set("b", 2).lpush("c", 3).set("d", 4)
127 with pytest.raises(redis.ResponseError) as ex:
128 pipe.execute()
129 assert str(ex.value).startswith(
130 "Command # 3 (LPUSH c 3) of pipeline caused error: "
131 )
132
133 # make sure the pipe was restored to a working state
134 assert pipe.set("z", "zzz").execute() == [True]
135 assert r["z"] == b"zzz"
136
137 @pytest.mark.onlynoncluster
138 def test_transaction_with_empty_error_command(self, r):

Callers

nothing calls this directly

Calls 4

lpushMethod · 0.80
pipelineMethod · 0.45
setMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected