#NEWLINE# @ mock . patch . object ( requests , '__build__' , 132352 ) #NEWLINE# @ mock . patch . object ( poolmanager , 'PoolManager' ) #NEWLINE# def test_keep_alive_on_newer_requests_with_idle( PoolManager ) : #NEWLINE# #INDENT# 'Show that options are generated correctly from kwargs with KEEPIDLE.' #NEWLINE# with set_keepidle ( 3000 ) : #NEWLINE# #INDENT# socket_opts = [ ( socket . IPPROTO_TCP , socket . TCP_NODELAY , 1 ) , ( socket . SOL_SOCKET , socket . SO_KEEPALIVE , 1 ) , ( socket . IPPROTO_TCP , socket . TCP_KEEPINTVL , 10 ) , ( socket . IPPROTO_TCP , socket . TCP_KEEPCNT , 10 ) , ( socket . IPPROTO_TCP , socket . TCP_KEEPIDLE , 30 ) ] #NEWLINE# adapter = socket_options . TCPKeepAliveAdapter ( idle = 30 , interval = 10 , count = 10 , pool_connections = 10 , pool_maxsize = 5 , pool_block = True ) #NEWLINE# #UNINDENT# PoolManager . assert_called_once_with ( num_pools = 10 , maxsize = 5 , block = True , socket_options = PoolManager ) #NEWLINE# assert ( adapter . socket_options == socket_opts )