code: def test_pl_app_destination_app_already_exists(tmp_path, monkeypatch):
      """Test that the CLI prints an error message if an app with the same name already exists."""
      runner = CliRunner()
      monkeypatch.chdir(tmp_path)
  
      source_dir = tmp_path / "code"
      script_file = source_dir / "script.py"
      source_dir.mkdir(parents=True)
      script_file.parent.mkdir(parents=True, exist_ok=True)
      script_file.touch()
  
      # monkeypatch.chdir(tmp_path)
      app_folder = tmp_path / "existing-app"
      app_folder.mkdir(parents=True)
  
      result = runner.invoke(
          lightning_cli.init_pl_app,
          (str(source_dir), str(script_file), "--name", "existing-app"),
      )
      assert result.exit_code == 1
      assert (
          "There is already an app with the name existing-app in the current working directory"
          in result.output
      )
  
file_path: pytorch-lightning/tests/tests_app/cli/test_cmd_pl_init.py
imports: import os
  import sys
  from unittest import mock
  from unittest.mock import Mock
  import pytest
  from click.testing import CliRunner
  from lightning.app.cli import lightning_cli
  from lightning.app.cli.cmd_pl_init import _can_encode_icon, download_frontend, pl_app
label_desc: Use image node_id 3 for calling a global function with example usage: test_pl_app_destination_app_already_exists(tmp_path, monkeypatch) without return types