parameters: (context, port)
docstring: :type context: behave.runner.Context
      :type port: int
docstring_summary: :type context: behave.runner.Context
      :type port: int
docstring_tokens: : type context : behave . runner . Context : type port : int
function: def step_impl(context, port):
      """
      :type context: behave.runner.Context
      :type port: int
      """
  
      def port_listening():
          try:
              sock = socket.socket()
              sock.connect(('localhost', port))
              sock.close()
              return True
          except ConnectionRefusedError:
              return False
  
      try_until(context, port_listening, context.options.max_attempts)
function_tokens: def step_impl ( context , port ) : def port_listening ( ) : try : sock = socket . socket ( ) sock . connect ( ( 'localhost' , port ) ) sock . close ( ) return True except ConnectionRefusedError : return False try_until ( context , port_listening , context . options . max_attempts )