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

Method test_on_connect_error

tests/test_connection_pool.py:919–932  ·  view source on GitHub ↗

An error in Connection.on_connect should disconnect from the server see for details: https://github.com/andymccurdy/redis-py/issues/368

(self)

Source from the content-addressed store, hash-verified

917class TestConnection:
918 @pytest.mark.fixed_client
919 def test_on_connect_error(self):
920 """
921 An error in Connection.on_connect should disconnect from the server
922 see for details: https://github.com/andymccurdy/redis-py/issues/368
923 """
924 # this assumes the Redis server being tested against doesn't have
925 # 9999 databases ;)
926 bad_connection = redis.Redis(db=9999)
927 # an error should be raised on connect
928 with pytest.raises(redis.RedisError):
929 bad_connection.info()
930 pool = bad_connection.connection_pool
931 assert len(pool._available_connections) == 1
932 assert not pool._available_connections[0]._sock
933
934 @pytest.mark.onlynoncluster
935 @skip_if_server_version_lt("2.8.8")

Callers

nothing calls this directly

Calls 1

infoMethod · 0.45

Tested by

no test coverage detected