code: def test_streamlit_frontend_start_stop_server(subprocess_mock):
      """Test that `StreamlitFrontend.start_server()` invokes subprocess.Popen with the right parameters."""
      frontend = StreamlitFrontend(render_fn=_noop_render_fn)
      frontend.flow = MockFlow()
      frontend.start_server(host="hostname", port=1111)
      subprocess_mock.Popen.assert_called_once()
  
      env_variables = subprocess_mock.method_calls[0].kwargs["env"]
      call_args = subprocess_mock.method_calls[0].args[0]
      assert call_args == [
          sys.executable,
          "-m",
          "streamlit",
          "run",
          ANY,
          "--server.address",
          "hostname",
          "--server.port",
          "1111",
          "--server.baseUrlPath",
          "root.my.flow",
          "--server.headless",
          "true",
          "--server.enableXsrfProtection",
          "false",
      ]
  
      assert env_variables["LIGHTNING_FLOW_NAME"] == "root.my.flow"
      assert (
          env_variables["LIGHTNING_RENDER_FUNCTION"]
          == "_noop_render_fn"
      )
      assert env_variables["LIGHTNING_RENDER_MODULE_FILE"] == __file__
  
      assert "LIGHTNING_FLOW_NAME" not in os.environ
      assert "LIGHTNING_RENDER_FUNCTION" not in os.environ
      assert "LIGHTNING_RENDER_MODULE_FILE" not in os.environ
  
      frontend.stop_server()
      subprocess_mock.Popen().kill.assert_called_once()
  
file_path: pytorch-lightning/tests/tests_app/frontend/test_stream_lit.py
imports: import os
  import runpy
  import sys
  from unittest import mock
  from unittest.mock import ANY, Mock
  import pytest
  from lightning.app import LightningFlow
  from lightning.app.frontend.stream_lit import StreamlitFrontend
  from lightning.app.utilities.state import AppState
  from lightning_utilities.core.imports import RequirementCache
label_desc: Use image node_id 3 for calling a global function with example usage: test_streamlit_frontend_start_stop_server(subprocess_mock) without return types