@@ -187,3 +187,34 @@ def test_busy_loading_disconnects_socket(self, r):
187
187
pool = r .connection_pool
188
188
assert len (pool ._available_connections ) == 1
189
189
assert not pool ._available_connections [0 ]._sock
190
+
191
+ @skip_if_server_version_lt ('2.8.8' )
192
+ def test_busy_loading_from_pipeline_immediate_command (self , r ):
193
+ """
194
+ BusyLoadingErrors should raise from Pipelines that execute a
195
+ command immediately, like WATCH does.
196
+ """
197
+ pipe = r .pipeline ()
198
+ with pytest .raises (redis .BusyLoadingError ):
199
+ pipe .immediate_execute_command ('DEBUG' , 'ERROR' ,
200
+ 'LOADING fake message' )
201
+ pool = r .connection_pool
202
+ assert not pipe .connection
203
+ assert len (pool ._available_connections ) == 1
204
+ assert not pool ._available_connections [0 ]._sock
205
+
206
+ # TODO: This fails on hiredis. need to think about this
207
+ # @skip_if_server_version_lt('2.8.8')
208
+ # def test_busy_loading_from_pipeline(self, r):
209
+ # """
210
+ # BusyLoadingErrors should be raised from a pipeline execution
211
+ # regardless of the raise_on_error flag.
212
+ # """
213
+ # pipe = r.pipeline()
214
+ # pipe.execute_command('DEBUG', 'ERROR', 'LOADING fake message')
215
+ # with pytest.raises(redis.BusyLoadingError):
216
+ # pipe.execute()
217
+ # pool = r.connection_pool
218
+ # assert not pipe.connection
219
+ # assert len(pool._available_connections) == 1
220
+ # assert not pool._available_connections[0]._sock
0 commit comments