#NEWLINE# def setUp( self ) : #NEWLINE# #INDENT# self . zmq_host = 'some.host' #NEWLINE# self . zmq_work_port = 9372 #NEWLINE# self . zmq_results_port = 48292 #NEWLINE# self . work_endpoint = ( 'tcp://%s:%d' % ( self . zmq_host , self . zmq_work_port ) ) #NEWLINE# self . results_endpoint = ( 'tcp://%s:%d' % ( self . zmq_host , self . zmq_results_port ) ) #NEWLINE# self . max_retries = 9 #NEWLINE# self . concurrency = 223 #NEWLINE# self . worker_id = 3 #NEWLINE# self . mock_context = flexmock ( ) #NEWLINE# flexmock ( zmq . Context ) . new_instances ( self . mock_context ) . once #NEWLINE# self . mock_work_pull = flexmock ( ) #NEWLINE# self . mock_context . should_receive ( 'socket' ) . with_args ( zmq . PULL ) . and_return ( self . mock_work_pull ) . once #NEWLINE# self . mock_work_pull . should_receive ( 'connect' ) . with_args ( self . work_endpoint ) . once #NEWLINE# self . mock_results_push = flexmock ( ) #NEWLINE# self . mock_context . should_receive ( 'socket' ) . with_args ( zmq . PUSH ) . and_return ( self . mock_results_push ) . once #NEWLINE# self . mock_results_push . should_receive ( 'connect' ) . with_args ( self . results_endpoint ) . once #NEWLINE# self . result_queue = flexmock ( ) #NEWLINE# self . mock_Queue = flexmock ( gevent . queue . Queue ) #NEWLINE# self . mock_Queue . new_instances ( self . result_queue ) . with_args ( gevent . queue . Queue ) . once #NEWLINE# with mock . patch . object ( ssbench . worker , 'is_ipv6' ) as mock_is_ipv6 : #NEWLINE# #INDENT# mock_is_ipv6 . return_value = False #NEWLINE# self . worker = worker . Worker ( self . zmq_host , self . zmq_work_port , self . zmq_results_port , self . worker_id , mock_is_ipv6 . max_retries ) #NEWLINE# mock_is_ipv6 . assert_called_once_with ( self . zmq_host ) #NEWLINE# #UNINDENT# self . mock_worker = flexmock ( self . worker ) #NEWLINE# self . stub_time = 98438243.3921 #NEWLINE# self . time_expectation = flexmock ( time ) . should_receive ( 'time' ) . and_return ( self . stub_time ) #NEWLINE# self . stub_fn_return = { #NEWLINE# #INDENT# 'x-trans-id' : 'slambammer!' , #NEWLINE# #UNINDENT# } #NEWLINE# self . stub_fn_calls = [ ] #NEWLINE# self . mock_token_data_lock = flexmock ( self . worker . token_data_lock ) #NEWLINE# self . mock_conn_pools_lock = flexmock ( self . worker . conn_pools_lock ) #NEWLINE# self . mock_client = flexmock ( client )