code: def test_initialize_process_props():
      from dtale import app
  
      ups = [True, True, False]
  
      def mock_is_up(_base):
          if len(ups):
              return ups.pop(0)
          return True
  
      with ExitStack() as stack:
          stack.enter_context(mock.patch("dtale.app.is_up", mock_is_up))
          mock_kill = stack.enter_context(
              mock.patch("dtale.app.kill", mock.Mock())
          )
          mock_sleep = stack.enter_context(
              mock.patch("time.sleep", mock.Mock())
          )
          app.initialize_process_props(
              host="localhost", port=40000, force=True
          )
          assert app.ACTIVE_HOST == "localhost"
          assert app.ACTIVE_PORT == 40000
          app.initialize_process_props(
              host="localhost", port=40000, force=True
          )
          mock_kill.assert_called_once()
          mock_sleep.assert_called_once()
          assert app.ACTIVE_HOST == "localhost"
          assert app.ACTIVE_PORT == 40000
  
      app.ACTIVE_PORT = None
      app.ACTIVE_HOST = None
  
      with ExitStack() as stack:
          stack.enter_context(mock.patch("dtale.app.is_up", mock_is_up))
          stack.enter_context(
              mock.patch(
                  "dtale.app.kill",
                  mock.Mock(side_effect=Exception("test")),
              )
          )
          stack.enter_context(
              mock.patch(
                  "dtale.app.find_free_port",
                  mock.Mock(return_value=40001),
              )
          )
          with pytest.raises(IOError) as excinfo:
              app.initialize_process_props(
                  host="localhost", port=40000, force=True
              )
          assert (
              "Could not kill process at http://localhost:40000, possibly something else is running at "
              "port 40000. Please try another port."
          ) in str(excinfo)
  
      app.ACTIVE_PORT = None
      app.ACTIVE_HOST = None
  
imports: import getpass
  from collections import namedtuple
  from flask import Flask
  import mock
  import numpy
  import os
  import pandas
  import pytest
  from tests import ExitStack, pdt
label_desc: Use image node_id 1 for calling a global function with example usage: test_initialize_process_props() and returns: True, ups