code: def testing_server(root, builder=lambda: None, mount_path="/"):
      """Create the server and start most of its parts, but don't listen on a socket."""
      with mock.patch("socket.socket"):
          server = LiveReloadServer(
              builder,
              host="localhost",
              port=0,
              root=root,
              mount_path=mount_path,
              polling_interval=0.2,
          )
          server.server_name = "localhost"
          server.server_port = 0
          server.setup_environ()
      server.observer.start()
      thread = threading.Thread(target=server._build_loop, daemon=True)
      thread.start()
      yield server
      server.shutdown()
      thread.join()
  
imports: import contextlib
  import email
  import io
  import sys
  import threading
  import time
  import unittest
  from pathlib import Path
  from unittest import mock
  from mkdocs.livereload import LiveReloadServer
  from mkdocs.tests.base import change_dir, tempdir
label_desc: Use image node_id 1 for calling a global function with example usage: testing_server(root, builder, mount_path) without return types